You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
53 lines
1.5 KiB
JavaScript
53 lines
1.5 KiB
JavaScript
// rollup.config.js
|
|
|
|
import babel from 'rollup-plugin-babel';
|
|
import nodeResolve from 'rollup-plugin-node-resolve';
|
|
import commonjs from 'rollup-plugin-commonjs';
|
|
import { uglify } from 'rollup-plugin-uglify';
|
|
import common from './rollup';
|
|
|
|
const prod = process.env.NODE_ENV;
|
|
|
|
export default {
|
|
input: 'src/index.js',
|
|
output: {
|
|
file: prod ? 'dist/index.aio.min.js' : 'dist/index.aio.js',
|
|
format: 'umd',
|
|
// 如果不同时使用 export 与 export default 可打开legacy
|
|
// legacy: true,
|
|
// name: common.name,
|
|
name: 'QrcodeDecoder',
|
|
banner: common.banner,
|
|
},
|
|
plugins: [
|
|
nodeResolve({
|
|
main: true,
|
|
}),
|
|
commonjs({
|
|
include: 'node_modules/**',
|
|
}),
|
|
babel({
|
|
runtimeHelpers: true,
|
|
exclude: 'node_modules/**',
|
|
}),
|
|
prod &&
|
|
uglify({
|
|
compress: {
|
|
drop_debugger: true,
|
|
drop_console: true,
|
|
},
|
|
output: {
|
|
comments: (node, comment) => {
|
|
if (comment.type === 'comment2') {
|
|
// multiline comment
|
|
return /@preserve|@license|@cc_on/i.test(
|
|
comment.value,
|
|
);
|
|
}
|
|
return false;
|
|
},
|
|
},
|
|
}),
|
|
],
|
|
};
|