UNPKG

1.4 kBJavaScriptView Raw
1const base = require("./base");
2const path = require("path");
3const webpack = require("webpack");
4const merge = require("webpack-merge");
5const HtmlWebpackPlugin = require('html-webpack-plugin');
6
7const htmlWebpackPlugin = new HtmlWebpackPlugin({
8 inject: true,
9 filename: path.join(__dirname, '../examples/dist/index.html'),
10 template: path.join(__dirname, '../examples/index.html'),
11 meta: {
12 'viewport': 'width=device-width, initial-scale=1, shrink-to-fit=no',
13 }
14});
15
16module.exports = merge(base, {
17
18 entry: {
19 main: ["./src/examples"]
20 },
21
22 output: {
23 path: path.join(__dirname, '../examples/dist'),
24 publicPath: '',
25 filename: '[name].js',
26 chunkFilename: '[name].chunk.js'
27 },
28
29 resolve: {
30 alias: {
31 //"fb-ui": '../../src/index',
32 }
33 },
34
35 plugins: [
36 htmlWebpackPlugin,
37 new webpack.HotModuleReplacementPlugin()
38 ],
39
40 // optimization: {
41 // splitChunks: {
42 // commons: {
43 // test: /[\\/]node_modules[\\/]/,
44 // name: 'vendors',
45 // chunks: 'all'
46 // }
47 // }
48 // },
49
50 devServer: {
51 contentBase: path.join(__dirname, '../dist'), // 根目录
52 hot: true, // 是否开启热替换,无须手动刷新浏览器
53 host: "192.168.199.18",
54 port: 8081, // 端口
55 open: true, // 是否自动打开浏览器
56 noInfo: false, // 不提示打包信息,错误和警告仍然会显示
57 disableHostCheck: true, // 新增该配置项
58 //overlay: true,
59 },
60});
\No newline at end of file