Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion src/index.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class ScratchWebpackConfigBuilder {
* @param {string|URL} [options.srcPath] The absolute path to the source files. Defaults to `src` under `rootPath`.
* @param {boolean} [options.shouldSplitChunks] Whether to enable spliting code to chunks.
*/
constructor ({ distPath, enableReact, enableTs, libraryName, rootPath, srcPath, publicPath = '/', shouldSplitChunks }) {
constructor ({ distPath, enableReact, enableTs, libraryName, rootPath, srcPath, publicPath = '/', shouldSplitChunks, cssModuleExceptions = [] }) {
const isProduction = process.env.NODE_ENV === 'production';
const mode = isProduction ? 'production' : 'development';

Expand Down Expand Up @@ -184,6 +184,7 @@ class ScratchWebpackConfigBuilder {
enableReact ? [
{
test: /\.css$/,
exclude: cssModuleExceptions,
use: [
{
loader: 'style-loader'
Expand Down Expand Up @@ -213,6 +214,25 @@ class ScratchWebpackConfigBuilder {
}
}
]
},
{
test: cssModuleExceptions,
use: [
'style-loader',
'css-loader',
{
loader: 'postcss-loader',
options: {
postcssOptions: {
plugins: [
'postcss-import',
'postcss-simple-vars',
'autoprefixer'
]
}
}
}
]
}
] : []
),
Expand Down