Skip to content
Open
Changes from all commits
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
8 changes: 5 additions & 3 deletions lib/webpack.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,17 @@ exports.chainWebpack = (webpackConfig) => {
webpackConfig.plugins.delete('friendly-errors')

const isExtracting = webpackConfig.plugins.has('extract-css')
if (isExtracting && config.criticalCSS) {
if (isExtracting) {
// Remove extract
const langs = ['css', 'postcss', 'scss', 'sass', 'less', 'stylus']
const types = ['vue-modules', 'vue', 'normal-modules', 'normal']
for (const lang of langs) {
for (const type of types) {
const rule = webpackConfig.module.rule(lang).oneOf(type)
rule.uses.delete('extract-css-loader')
// Critical CSS
rule.use('css-context').loader(CssContextLoader).before('css-loader')
if (config.criticalCSS) {
rule.use('css-context').loader(CssContextLoader).before('css-loader')
}
}
}
webpackConfig.plugins.delete('extract-css')
Expand All @@ -56,6 +57,7 @@ exports.chainWebpack = (webpackConfig) => {
...htmlPlugin.get('args')[0],
template: config.api.resolve('public/index.ssr.html'),
filename: 'index.ssr.html',
chunks: [],
},
])

Expand Down