Last active
July 23, 2018 13:47
-
-
Save cfrank/bfd24d2094544e939959189e29c9b8f4 to your computer and use it in GitHub Desktop.
Webpack initial version
This file contains 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 config = { | |
context: path.resolve(__dirname, 'src'), | |
entry: { | |
app: './index.jsx', | |
}, | |
resolve: { | |
modules: [ | |
path.resolve(__dirname, 'src'), | |
"node_modules" | |
], | |
extensions: ['.js', '.jsx'] | |
}, | |
output: { | |
path: path.resolve(__dirname, 'dist/'), | |
filename: 'output.js', | |
publicPath: '/dist/', | |
}, | |
devtool: 'eval-source-map', | |
devServer: { | |
contentBase: path.resolve(__dirname, 'src'), | |
historyApiFallback: true, | |
}, | |
module: { | |
rules: [ | |
{ | |
test: /\.scss$/, | |
exclude: /node_modules/, | |
use: [ | |
{ | |
loader: MiniCssExtractPlugin.loader, | |
}, | |
{ | |
loader: 'css-loader', | |
options: { | |
modules: true, | |
localIdentName: '[name]__[local]', | |
}, | |
}, | |
{ | |
loader: 'sass-loader', | |
options: { | |
includePaths: ['src'], | |
}, | |
}, | |
{ | |
loader: 'postcss-loader', | |
}, | |
] | |
}, | |
{ | |
test: /\.(js|jsx)$/, | |
exclude: /node_modules/, | |
use: [{ | |
loader: 'babel-loader' | |
}], | |
}, | |
{ | |
test: /\.(png|jpg|svg)$/, | |
use: [{ | |
loader: 'file-loader', | |
options: { | |
name: '[name]-[hash].[ext]', | |
outputPath: 'assets/images/' | |
}, | |
}], | |
}, | |
], | |
}, | |
plugins: [ | |
new MiniCssExtractPlugin({ | |
filename: '[name].css', | |
chunkFilename: '[id].css', | |
}), | |
], | |
} | |
module.exports = config; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment