Created
September 25, 2018 18:34
-
-
Save codyogden/df6740eb31aede71cde05c3cef00c2a1 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
const webpack = require('webpack'); | |
module.exports = (env, argv) => { | |
const config = { | |
entry: './src/App.jsx', | |
output: { | |
path: __dirname, | |
publicPath: '/', | |
filename: '[name].js', | |
}, | |
module: { | |
rules: [{ | |
test: /\.(js|jsx)$/, | |
exclude: /node_modules/, | |
use: { | |
loader: 'babel-loader', | |
options: { | |
presets: ['@babel/preset-env'], | |
}, | |
}, | |
}, | |
{ | |
test: /\.scss$/, | |
exclude: /node_modules/, | |
use: [ | |
'style-loader', | |
'css-loader', | |
'sass-loader', | |
], | |
}, | |
], | |
}, | |
resolve: { | |
extensions: ['*', '.js', '.jsx'], | |
alias: {}, | |
}, | |
plugins: [ | |
new webpack.HotModuleReplacementPlugin(), | |
], | |
devServer: { | |
contentBase: './', | |
hot: true, | |
}, | |
}; | |
if (argv.mode === 'production') { | |
config.resolve.alias.react = 'preact-compat'; | |
config.resolve.alias['react-dom'] = 'preact-compat'; | |
} | |
return config; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment