Skip to content

Commit fe8875e

Browse files
committed
Set experimental.css to production
1 parent 7c37dd5 commit fe8875e

File tree

2 files changed

+6
-17
lines changed

2 files changed

+6
-17
lines changed

programs/develop/webpack/plugin-css/index.ts

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -36,22 +36,18 @@ export class CssPlugin {
3636
{
3737
test: /\.css$/,
3838
exclude: /\.module\.css$/,
39-
type: 'css',
4039
oneOf: [
4140
{
4241
resourceQuery: /inline_style/,
42+
type: 'javascript/auto',
4343
use: await commonStyleLoaders(projectPath, {
4444
mode: mode as 'development' | 'production',
4545
useMiniCssExtractPlugin: false,
4646
useShadowDom: true
4747
})
4848
},
4949
{
50-
use: await commonStyleLoaders(projectPath, {
51-
mode: mode as 'development' | 'production',
52-
useMiniCssExtractPlugin: mode === 'production',
53-
useShadowDom: false
54-
})
50+
type: 'css/auto'
5551
}
5652
]
5753
},
@@ -61,18 +57,15 @@ export class CssPlugin {
6157
oneOf: [
6258
{
6359
resourceQuery: /inline_style/,
60+
type: 'javascript/auto',
6461
use: await commonStyleLoaders(projectPath, {
6562
mode: mode as 'development' | 'production',
6663
useMiniCssExtractPlugin: false,
6764
useShadowDom: true
6865
})
6966
},
7067
{
71-
use: await commonStyleLoaders(projectPath, {
72-
mode: mode as 'development' | 'production',
73-
useMiniCssExtractPlugin: mode === 'production',
74-
useShadowDom: false
75-
})
68+
type: 'css/auto'
7669
}
7770
]
7871
}

programs/develop/webpack/webpack-config.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -161,12 +161,8 @@ export default function webpackConfig(
161161
// }
162162
},
163163
experiments: {
164-
// Enable native CSS support. Note that it's an experimental feature still under development
165-
// and will be enabled by default in webpack v6, however you can track the progress on GitHub
166-
// here: https://github.com/webpack/webpack/issues/14893.
167-
// css: devOptions.experimental?.hotReload
168-
// ? true
169-
// : devOptions.mode === 'production',
164+
// Enable native CSS support by default
165+
css: true,
170166
// Support the new WebAssembly according to the updated specification,
171167
// it makes a WebAssembly module an async module.
172168
asyncWebAssembly: true

0 commit comments

Comments
 (0)