UNPKG

1.01 kBJavaScriptView Raw
1const path = require('path');
2const webpack = require('webpack');
3const CleanWebpackPlugin = require('clean-webpack-plugin');
4// const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
5
6// webpack 配置
7let webpackConfig = {
8 entry: {
9 index: './src/index.js',
10 },
11 output: {
12 path: path.resolve(__dirname, `./build`), // 输出路径
13 filename: '[name].js', // js 文件路径
14 library: 'ISO6391',
15 libraryTarget: 'umd'
16 },
17 devtool: 'cheap-source-map',
18 module: {
19 rules: [
20 {
21 test: /\.js$/,
22 exclude: /node_modules/,
23 use: {
24 loader: 'babel-loader',
25 options: {
26 cacheDirectory: require('os').tmpdir(),
27 presets: ['es2015', 'stage-0'],
28 plugins: ['add-module-exports', 'transform-runtime'],
29 },
30 },
31 },
32 ],
33 },
34 plugins: [
35 new webpack.NamedModulesPlugin(),
36 new CleanWebpackPlugin(['./build']),
37 // new UglifyJSPlugin()
38 ],
39};
40
41module.exports = webpackConfig;