1 | const path = require('path');
|
2 | const webpack = require('webpack');
|
3 | const NpmInstallPlugin = require('npm-install-webpack-plugin');
|
4 | const ExtractTextPlugin = require('extract-text-webpack-plugin');
|
5 |
|
6 |
|
7 | const config = {
|
8 | entry: {
|
9 | index: "./src/index.js"
|
10 | },
|
11 | output: {
|
12 | path: path.resolve(__dirname, "site"),
|
13 | filename: "[name].js"
|
14 | },
|
15 | resolve: {
|
16 | extensions: [".js", ".json", ".jsx", ".css"],
|
17 | },
|
18 | module: {
|
19 |
|
20 | },
|
21 | module: {
|
22 | rules: [
|
23 | {
|
24 | test: /\.jsx?$/,
|
25 | include: [
|
26 | path.resolve(__dirname, "src")
|
27 | ],
|
28 | use: ['babel-loader']
|
29 | },
|
30 | {
|
31 | test: /\.css$/,
|
32 | use: [ 'style-loader', 'css-loader' ]
|
33 | },
|
34 | {
|
35 | test: /\.md$/,
|
36 | use: ['babel-loader', path.resolve(__dirname, 'src/lib/md-loader.js') ]
|
37 | },
|
38 | {
|
39 | test: /\.less$/,
|
40 | use: [{
|
41 | loader: "style-loader"
|
42 | }, {
|
43 | loader: "css-loader"
|
44 | }, {
|
45 | loader: "less-loader"
|
46 | }]
|
47 | }
|
48 | ],
|
49 | },
|
50 |
|
51 | devtool: "source-map",
|
52 |
|
53 | devServer: {
|
54 |
|
55 |
|
56 |
|
57 | host: "0.0.0.0",
|
58 | port: 9000,
|
59 | contentBase: path.join(__dirname, 'site'),
|
60 | compress: true,
|
61 | historyApiFallback: true,
|
62 | hot: true,
|
63 | https: false,
|
64 | noInfo: true,
|
65 | publicPath: '/'
|
66 |
|
67 | },
|
68 |
|
69 | plugins: [
|
70 | new webpack.HotModuleReplacementPlugin(),
|
71 | new webpack.DefinePlugin({
|
72 | 'process.env.NODE_ENV': '"production"',
|
73 | }),
|
74 | new ExtractTextPlugin({filename: '[name].css', disable: false, allChunks: true}),
|
75 |
|
76 | ]
|
77 |
|
78 | }
|
79 |
|
80 | module.exports = config; |
\ | No newline at end of file |