init commit
This commit is contained in:
38
webpack.base.js
Normal file
38
webpack.base.js
Normal file
@@ -0,0 +1,38 @@
|
||||
const path = require('path');
|
||||
const rules = require('./webpack.rules.js');
|
||||
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
||||
const CpWebpackPlugin = require('cp-webpack-plugin');
|
||||
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
|
||||
|
||||
const output = path.resolve('./dist');
|
||||
|
||||
const entry = {
|
||||
'index': path.resolve('./src/index.js'),
|
||||
}
|
||||
|
||||
const config = {
|
||||
entry: entry,
|
||||
output: {
|
||||
path: output,
|
||||
filename: '[name].js',
|
||||
globalObject: 'this',
|
||||
libraryTarget: 'var',
|
||||
},
|
||||
module: {
|
||||
rules,
|
||||
},
|
||||
plugins: [
|
||||
new CleanWebpackPlugin(),
|
||||
new HtmlWebpackPlugin({
|
||||
filename: 'index.html',
|
||||
template: 'demo.html'
|
||||
}),
|
||||
new CpWebpackPlugin([
|
||||
{ from: path.resolve('./types'), to: path.resolve('./dist') }
|
||||
])
|
||||
],
|
||||
devtool: 'cheap-module-souce-map',
|
||||
mode: 'development',
|
||||
};
|
||||
|
||||
module.exports = config;
|
||||
Reference in New Issue
Block a user