Skip to content

Commit

Permalink
style-loader inlining
Browse files Browse the repository at this point in the history
  • Loading branch information
guybedford committed Jan 14, 2021
1 parent 93254d8 commit 4ab205d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
Expand Up @@ -10,7 +10,7 @@ export function getClientStyleLoader({
}): webpack.RuleSetUseItem {
return isDevelopment
? {
loader: require.resolve('style-loader'),
loader: require.resolve('next/dist/compiled/style-loader'),
options: {
// By default, style-loader injects CSS into the bottom
// of <head>. This causes ordering problems between dev
Expand Down
2 changes: 1 addition & 1 deletion packages/next/package.json
Expand Up @@ -97,7 +97,6 @@
"react-refresh": "0.8.3",
"resolve-url-loader": "3.1.2",
"stream-browserify": "3.0.0",
"style-loader": "1.2.1",
"styled-jsx": "3.3.2",
"use-subscription": "1.5.1",
"vm-browserify": "1.1.2",
Expand Down Expand Up @@ -223,6 +222,7 @@
"source-map": "0.6.1",
"string-hash": "1.1.3",
"strip-ansi": "6.0.0",
"style-loader": "1.2.1",
"taskr": "1.1.0",
"terser": "5.5.1",
"text-table": "0.2.0",
Expand Down
15 changes: 15 additions & 0 deletions packages/next/taskfile.js
Expand Up @@ -519,6 +519,20 @@ export async function ncc_strip_ansi(task, opts) {
.target('compiled/strip-ansi')
}
// eslint-disable-next-line camelcase
externals['style-loader'] = 'next/dist/compiled/style-loader'
export async function ncc_style_loader(task, opts) {
await task
.source(opts.src || relative(__dirname, require.resolve('style-loader')))
.ncc({
packageName: 'style-loader',
externals: {
...externals,
'schema-utils': 'next/dist/compiled/schema-utils3',
},
})
.target('compiled/style-loader')
}
// eslint-disable-next-line camelcase
externals['terser'] = 'next/dist/compiled/terser'
export async function ncc_terser(task, opts) {
await task
Expand Down Expand Up @@ -695,6 +709,7 @@ export async function ncc(task) {
'ncc_source_map',
'ncc_string_hash',
'ncc_strip_ansi',
'ncc_style_loader',
'ncc_terser',
'ncc_text_table',
'ncc_thread_loader',
Expand Down

0 comments on commit 4ab205d

Please sign in to comment.