Skip to content

Commit 47ec677

Browse files
authored
chore: compile css-loader (vercel#21357)
This PR compiles `css-loader` to resolve a peer dep warning.
1 parent 55b8502 commit 47ec677

9 files changed

Lines changed: 43 additions & 3 deletions

File tree

packages/next/build/webpack/config/blocks/css/loaders/global.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export function getGlobalCssLoader(
2424

2525
// Resolve CSS `@import`s and `url()`s
2626
loaders.push({
27-
loader: require.resolve('css-loader'),
27+
loader: require.resolve('next/dist/compiled/css-loader'),
2828
options: {
2929
importLoaders: 1 + preProcessors.length,
3030
sourceMap: true,

packages/next/build/webpack/config/blocks/css/loaders/modules.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export function getCssModuleLoader(
2525

2626
// Resolve CSS `@import`s and `url()`s
2727
loaders.push({
28-
loader: require.resolve('css-loader'),
28+
loader: require.resolve('next/dist/compiled/css-loader'),
2929
options: {
3030
importLoaders: 1 + preProcessors.length,
3131
sourceMap: true,
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
Copyright JS Foundation and other contributors
2+
3+
Permission is hereby granted, free of charge, to any person obtaining
4+
a copy of this software and associated documentation files (the
5+
'Software'), to deal in the Software without restriction, including
6+
without limitation the rights to use, copy, modify, merge, publish,
7+
distribute, sublicense, and/or sell copies of the Software, and to
8+
permit persons to whom the Software is furnished to do so, subject to
9+
the following conditions:
10+
11+
The above copyright notice and this permission notice shall be
12+
included in all copies or substantial portions of the Software.
13+
14+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
15+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
18+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
19+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
20+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

packages/next/compiled/css-loader/api.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/next/compiled/css-loader/cjs.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/next/compiled/css-loader/getUrl.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"name":"css-loader","main":"cjs.js","author":"Tobias Koppers @sokra","license":"MIT"}

packages/next/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@
7575
"chalk": "2.4.2",
7676
"chokidar": "3.5.1",
7777
"crypto-browserify": "3.12.0",
78-
"css-loader": "4.3.0",
7978
"cssnano-simple": "1.2.1",
8079
"etag": "1.8.1",
8180
"find-cache-dir": "3.3.1",
@@ -187,6 +186,7 @@
187186
"conf": "5.0.0",
188187
"content-type": "1.0.4",
189188
"cookie": "0.4.1",
189+
"css-loader": "4.3.0",
190190
"debug": "4.1.1",
191191
"devalue": "2.0.1",
192192
"escape-string-regexp": "2.0.0",

packages/next/taskfile.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,21 @@ export async function ncc_cookie(task, opts) {
203203
.target('compiled/cookie')
204204
}
205205
// eslint-disable-next-line camelcase
206+
externals['css-loader'] = 'next/dist/compiled/css-loader'
207+
export async function ncc_css_loader(task, opts) {
208+
await task
209+
.source(opts.src || relative(__dirname, require.resolve('css-loader')))
210+
.ncc({
211+
packageName: 'css-loader',
212+
externals: {
213+
...externals,
214+
'schema-utils': 'next/dist/compiled/schema-utils',
215+
},
216+
target: 'es5',
217+
})
218+
.target('compiled/css-loader')
219+
}
220+
// eslint-disable-next-line camelcase
206221
externals['debug'] = 'next/dist/compiled/debug'
207222
export async function ncc_debug(task, opts) {
208223
await task
@@ -669,6 +684,7 @@ export async function ncc(task) {
669684
'ncc_conf',
670685
'ncc_content_type',
671686
'ncc_cookie',
687+
'ncc_css_loader',
672688
'ncc_debug',
673689
'ncc_devalue',
674690
'ncc_escape_string_regexp',

0 commit comments

Comments
 (0)