1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- const { resolve } = require('path');
- const webpack = require('webpack');
- module.exports = {
- context: __dirname,
- entry: [
- // 'react-hot-loader/patch',
- // 'webpack/hot/only-dev-server',
- './app/src/index.js'
- ],
- output: {
- path: resolve(__dirname, 'build'),//打包后的文件存放的地方
- filename: "bundle.js",//打包后输出文件的文件名
- publicPath: "/"
- },
- devServer: {
- contentBase: resolve(__dirname, 'build'),
- hot: true,
- publicPath: '/',
- },
- module: {
- rules: [
- {
- test: /\.jsx?$/,
- use: [
- 'babel-loader',
- ],
- exclude: /node_modules/
- },
- {
- test: /\.css$/,
- use: [
- 'style-loader', 'css-loader'
- ],
- exclude: /node_modules/
- },
- ],
- },
- plugins: [
- new webpack.HotModuleReplacementPlugin(),
- new webpack.NamedModulesPlugin(),
- new webpack.optimize.UglifyJsPlugin({
- compress: {
- warnings: false
- }
- }),
- new webpack.DefinePlugin({
- 'process.env': {
- NODE_ENV: JSON.stringify(process.env.NODE_ENV),
- },
- }),
- ],
- // devtool: "cheap-eval-source-map",
- };
|