forked from staticdeng/vuejs-loadmore
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrollup.config.js
64 lines (62 loc) · 1.56 KB
/
rollup.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import path from 'path';
import vue from 'rollup-plugin-vue';
import resolve from '@rollup/plugin-node-resolve';
import postcss from 'rollup-plugin-postcss';
import babel from 'rollup-plugin-babel';
import commonjs from 'rollup-plugin-commonjs';
import { terser } from 'rollup-plugin-terser';
const pkg = require(path.resolve(__dirname, 'package.json'));
// 公共插件配置
const getPlugins = () => {
return [
resolve({
extensions: ['.vue', '.js']
}),
vue({
include: /\.vue$/,
normalizer: '~vue-runtime-helpers/dist/normalize-component.js'
}),
commonjs(),
postcss({
plugins: [require('autoprefixer')],
// 把 css 放到和js同一目录
// extract: true,
// Minimize CSS, boolean or options for cssnano.
minimize: true,
// Enable sourceMap.
sourceMap: false,
// This plugin will process files ending with these extensions and the extensions supported by custom loaders.
extensions: ['.sass', '.scss', '.css']
}),
babel({
exclude: 'node_modules/**',
extensions: ['.js', '.vue']
}),
terser()
];
};
export default {
input: path.resolve(__dirname, pkg.entry),
output: [
{
name: 'loadmore',
file: path.resolve(__dirname, pkg.main),
format: 'umd',
sourcemap: false,
globals: {
vue: 'vue'
}
},
{
name: 'loadmore',
file: path.join(__dirname, pkg.module),
format: 'es',
sourcemap: false,
globals: {
vue: 'vue'
}
}
],
plugins: getPlugins(),
external: ['vue']
};