Last active
January 24, 2020 13:52
-
-
Save r-i-c-h/e04d7800e5e7da8b2867169aaa9877db to your computer and use it in GitHub Desktop.
Webpack Code Splitting
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
/* orig https://gist.github.com/gaearon/ca6e803f5c604d37468b0091d9959269 */ | |
module.exports = { | |
entry: { | |
main: './src/app.js', | |
}, | |
output: { | |
// `filename` provides a template for naming your bundles (remember to use `[name]`) | |
filename: '[name].bundle.js', | |
// `chunkFilename` provides a template for naming code-split bundles (optional) | |
chunkFilename: '[name].bundle.js', | |
// `path` is the folder where Webpack will place your bundles | |
path: './dist', | |
// `publicPath` is where Webpack will load your bundles from (optional) | |
publicPath: 'dist/' | |
}, | |
module: { | |
rules: [ | |
{ | |
test: /\.(scss)$/, | |
use: [ | |
{ | |
// Adds CSS to the DOM by injecting a `<style>` tag | |
loader: 'style-loader' | |
}, | |
{ | |
// Interprets `@import` and `url()` like `import/require()` and will resolve themn | |
loader: 'css-loader' | |
}, | |
{ | |
// Loads a SASS/SCSS file and compiles it to CSS | |
loader: 'sass-loader' | |
} | |
] | |
} | |
] | |
}; | |
}; | |
// https://github.com/FullHuman/purgecss-webpack-plugin |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment