This repository has been archived on 2023-08-30. You can view files and clone it, but cannot push or open issues/pull-requests.
bytedo
/
anot
Archived
1
0
Fork 0

完成rollup配置

master
宇天 2020-08-13 15:58:18 +08:00
parent 2c6320b811
commit 2fcdf274cc
4 changed files with 62 additions and 16 deletions

9
copyright.js Normal file
View File

@ -0,0 +1,9 @@
import { version } from './package.json'
export default `/**
* Anot.js -- an mini mvvm framework
* @author yutent<yutent.io@gmail.com>
* @date 2020/08/13 15:26:11
* @version ${version}
*/
`

19
lib/plugin.esm.js Normal file
View File

@ -0,0 +1,19 @@
/**
* rollup plugin
* @author yutent<yutent.io@gmail.com>
* @date 2020/08/11 15:46:57
*/
export default function esm() {
return {
name: 'esm',
generateBundle(info, chunk) {
var item
for (let k in chunk) {
item = chunk[k]
break
}
item.code += 'export default _Anot\n'
}
}
}

View File

@ -1,22 +1,30 @@
// const uglify = require('@bytedo/rollup-plugin-uglify') /**
* 开发版配置
* @author yutent<yutent.io@gmail.com>
* @date 2020/08/13 15:28:39
*/
module.exports = [ import esm from './lib/plugin.esm'
export default [
{ {
input: 'src/anot.js', input: 'src/anot.js',
output: { output: {
file: 'dist/anot.js', file: 'dist/anot.js',
format: 'es', format: 'iife',
sourcemap: false sourcemap: true,
name: '_Anot'
}, },
plugins: [] plugins: [esm()]
}, },
{ {
input: 'src/anot.touch.js', input: 'src/anot.touch.js',
output: { output: {
file: 'dist/anot.touch.js', file: 'dist/anot.touch.js',
format: 'es', format: 'iife',
sourcemap: false sourcemap: true,
name: '_Anot'
}, },
plugins: [] plugins: [esm()]
} }
] ]

View File

@ -1,22 +1,32 @@
const uglify = require('@bytedo/rollup-plugin-uglify') /**
* 生产版配置
* @author yutent<yutent.io@gmail.com>
* @date 2020/08/13 15:28:39
*/
module.exports = [ import uglify from '@bytedo/rollup-plugin-uglify'
import esm from './lib/plugin.esm'
import copyright from './copyright'
export default [
{ {
input: 'src/anot.js', input: 'src/anot.js',
output: { output: {
file: 'dist/anot.js', file: 'dist/anot.js',
format: 'es', format: 'iife',
sourcemap: false banner: copyright,
name: '_Anot'
}, },
plugins: [uglify()] plugins: [esm(), uglify()]
}, },
{ {
input: 'src/anot.touch.js', input: 'src/anot.touch.js',
output: { output: {
file: 'dist/anot.touch.js', file: 'dist/anot.touch.js',
format: 'es', format: 'iife',
sourcemap: false banner: copyright,
name: '_Anot'
}, },
plugins: [uglify()] plugins: [esm(), uglify()]
} }
] ]