Skip to content

Instantly share code, notes, and snippets.

@WesleySmits
Created October 10, 2021 10:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save WesleySmits/d73d2257f857c6428cd310421a9507cb to your computer and use it in GitHub Desktop.
Save WesleySmits/d73d2257f857c6428cd310421a9507cb to your computer and use it in GitHub Desktop.
TS Starter: Webpack config add PostCSS loader
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