10 changed files with 1641 additions and 318 deletions
@ -1 +1,2 @@ |
|||
node_modules |
|||
dist |
File diff suppressed because it is too large
@ -0,0 +1,16 @@ |
|||
{ |
|||
"presets": [ |
|||
[ |
|||
"@babel/preset-env", |
|||
{ |
|||
"targets": { |
|||
"browsers": "last 2 versions, > 1%, ie >= 6, Android >= 4, iOS >= 6, and_uc > 9", |
|||
"node": "0.10" |
|||
}, |
|||
"modules": false, |
|||
"loose": false |
|||
} |
|||
] |
|||
], |
|||
"plugins": ["external-helpers"] |
|||
} |
@ -0,0 +1,7 @@ |
|||
import Person from './Person' |
|||
|
|||
export default class Man extends Person { |
|||
constructor(name) { |
|||
super(name, '男') |
|||
} |
|||
} |
@ -0,0 +1,10 @@ |
|||
export default class Person { |
|||
constructor(name, gender = '男') { |
|||
this.name = name |
|||
this.gender = gender |
|||
} |
|||
|
|||
say() { |
|||
console.log(`我的名字是${this.name},是一个${this.gender}生`) |
|||
} |
|||
} |
@ -0,0 +1,3 @@ |
|||
import Man from './Man'; |
|||
|
|||
new Man('KainStar').say(); |
File diff suppressed because it is too large
@ -0,0 +1,28 @@ |
|||
{ |
|||
"name": "rollup-demo1", |
|||
"version": "1.0.0", |
|||
"description": "", |
|||
"main": "main.js", |
|||
"scripts": { |
|||
"build": "rollup -c", |
|||
"node": "node ./dist/dist2.js" |
|||
}, |
|||
"repository": { |
|||
"type": "git", |
|||
"url": "git+http://git.poorman.top/topuser/rollup-demo" |
|||
}, |
|||
"keywords": [], |
|||
"author": "", |
|||
"license": "ISC", |
|||
"devDependencies": { |
|||
"@babel/plugin-external-helpers": "^7.7.4", |
|||
"rollup": "^1.27.3", |
|||
"rollup-plugin-babel": "^4.3.3" |
|||
}, |
|||
"dependencies": { |
|||
"@babel/core": "^7.7.7", |
|||
"@babel/preset-env": "^7.7.7", |
|||
"rollup-plugin-node-resolve": "^5.2.0", |
|||
"rollup-plugin-replace": "^2.2.0" |
|||
} |
|||
} |
@ -0,0 +1,3 @@ |
|||
### 这里是一个简单的demo,用于最简单的模块打包 |
|||
|
|||
https://segmentfault.com/a/1190000010628352?utm_source=tag-newest#articleHeader4 |
@ -0,0 +1,19 @@ |
|||
const babel = require('rollup-plugin-babel') |
|||
module.exports = { |
|||
input: 'main.js', |
|||
output: [{ |
|||
file: './dist/dist.js', |
|||
format: 'cjs' |
|||
}, |
|||
{ |
|||
file: './dist/dist2.js', |
|||
format: 'iife', |
|||
name: 'MyBundle' |
|||
} |
|||
], |
|||
plugins: [ |
|||
babel({ |
|||
exclude: 'node_modules/**' |
|||
}) |
|||
] |
|||
} |
Loading…
Reference in new issue