Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Always remove extract-css-loader on server #191

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
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