-
-
Save WesleySmits/d73d2257f857c6428cd310421a9507cb to your computer and use it in GitHub Desktop.
TS Starter: Webpack config add PostCSS loader
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
rules: [ | |
{ | |
test: /\.js$/, | |
exclude: /node_modules/, | |
use: ['babel-loader'] | |
}, | |
{ | |
test: /\.ts$/, | |
use: 'ts-loader', | |
exclude: /node_modules/ | |
}, | |
+ { | |
+ test: /\.p?(css)$/i, | |
+ oneOf: [ | |
+ { | |
+ resourceQuery: /module/, | |
+ use: [ | |
+ MiniCssExtractPlugin.loader, | |
+ { | |
+ loader: 'css-loader', | |
+ options: { | |
+ url: false, | |
+ sourceMap: env.production !== true, | |
+ importLoaders: 1, | |
+ modules: { | |
+ localIdentName: '[local]_[hash:base64:5]' | |
+ } | |
+ } | |
+ }, | |
+ { | |
+ loader: 'postcss-loader', | |
+ options: { | |
+ sourceMap: env.production !== true | |
+ } | |
+ } | |
+ ] | |
+ }, | |
+ { | |
+ use: [ | |
+ MiniCssExtractPlugin.loader, | |
+ { | |
+ loader: 'css-loader', | |
+ options: { | |
+ url: false, | |
+ sourceMap: env.production !== true, | |
+ importLoaders: 1, | |
+ modules: false | |
+ } | |
+ }, | |
+ { | |
+ loader: 'postcss-loader', | |
+ options: { | |
+ sourceMap: env.production !== true | |
+ } | |
+ } | |
+ ] | |
+ } | |
+ ] | |
+ } | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment