Created
May 20, 2017 00:21
-
-
Save Spring3/0522361fcaadb09e8262ac067b08539c to your computer and use it in GitHub Desktop.
Webpack 2 config [node,react,babel,webpack]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const webpack = require('webpack'); | |
| const path = require('path'); | |
| module.exports = { | |
| entry: './web/dynamic/react.js', | |
| output: { | |
| path: path.join(__dirname, 'web', 'static', 'js'), | |
| filename: 'bundle.min.js' | |
| }, | |
| target: 'node', | |
| resolve: { | |
| extensions: ['.js', '.jsx', '.json'] | |
| }, | |
| module: { | |
| rules: [{ | |
| test: path.join(__dirname, 'web', 'dynamic'), | |
| loader: 'babel-loader', | |
| query: { | |
| presets: ['es2016', 'es2017', 'react'] | |
| } | |
| }, { | |
| test: /\.json?$/, | |
| exclude: /node_modules/, | |
| loader: 'json-loader' | |
| }] | |
| }, | |
| plugins: [ | |
| new webpack.optimize.OccurrenceOrderPlugin(), | |
| new webpack.optimize.UglifyJsPlugin({ | |
| compress: { warnings: false }, | |
| mangle: true, | |
| sourcemap: false, | |
| beautify: false, | |
| dead_code: true | |
| }) | |
| ], | |
| watch: process.env.NODE_ENV !== 'production' | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment