Last active
March 23, 2019 03:46
-
-
Save areai51/3a9b3f5073a9c275fce9cf272d1d0bf7 to your computer and use it in GitHub Desktop.
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
| var path = require('path'); | |
| var PACKAGE = require('./package.json'); | |
| var HtmlWebpackPlugin = require('html-webpack-plugin'); | |
| var isProd = process.env.NODE_ENV !== 'dev'; | |
| var externals = {}; | |
| if (isProd) { | |
| externals = { | |
| react: 'react', | |
| 'react-dom': 'reactDOM', | |
| emotion: '@emotion/core', | |
| mobx: 'mobx', | |
| pubSub: 'pubSub', | |
| }; | |
| } | |
| var outputPathFragment = isProd ? '../../dist/' + PACKAGE.name : 'dist'; | |
| module.exports = { | |
| entry: './app/index.js', | |
| output: { | |
| path: path.resolve(__dirname, outputPathFragment), | |
| filename: `${PACKAGE.name}.app.js`, | |
| publicPath: isProd ? `/${PACKAGE.name}` : ``, | |
| }, | |
| externals: externals, | |
| module: { | |
| rules: [ | |
| { test: /\.(js)$/, use: 'babel-loader' } | |
| ], | |
| }, | |
| mode: 'production', | |
| plugins: [ | |
| new HtmlWebpackPlugin({ | |
| template: 'app/index.html', | |
| }), | |
| ], | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment