Files
smart-table/config/webpack.example.js
2020-02-08 13:51:13 +08:00

42 lines
1.1 KiB
JavaScript

const path = require('path');
const merge = require('webpack-merge');
const webpack = require("webpack");
const pkg = require('../package.json');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const {
CleanWebpackPlugin
} = require('clean-webpack-plugin');
const common = require('./webpack.common.js');
module.exports = merge(common, {
module: {
rules: [{
test: /\.js$/,
exclude: /(node_modules|bower_components)/, //排除掉node_module目录
use: {
loader: 'babel-loader',
options: {
presets: ['env']
}
}
}],
},
plugins: [
new CleanWebpackPlugin(),
new webpack.BannerPlugin(`smartTable v${pkg.version} | (c) pengyajun 2020 | Released under the MIT License.`),
new CopyWebpackPlugin([{
from: "examples/assets",
to: "assets"
}]),
new HtmlWebpackPlugin({
template: path.resolve(__dirname, '../examples/index.html'),
inject: 'head'
})
],
output: {
filename: 'smartTable.min.js',
path: path.resolve(__dirname, '../docs')
},
});