Skip to content

Commit

Permalink
chore: compile css-loader (#21357)
Browse files Browse the repository at this point in the history
This PR compiles `css-loader` to resolve a peer dep warning.
  • Loading branch information
Timer committed Jan 20, 2021
1 parent 55b8502 commit 47ec677
Show file tree
Hide file tree
Showing 9 changed files with 43 additions and 3 deletions.
Expand Up @@ -24,7 +24,7 @@ export function getGlobalCssLoader(

// Resolve CSS `@import`s and `url()`s
loaders.push({
loader: require.resolve('css-loader'),
loader: require.resolve('next/dist/compiled/css-loader'),
options: {
importLoaders: 1 + preProcessors.length,
sourceMap: true,
Expand Down
Expand Up @@ -25,7 +25,7 @@ export function getCssModuleLoader(

// Resolve CSS `@import`s and `url()`s
loaders.push({
loader: require.resolve('css-loader'),
loader: require.resolve('next/dist/compiled/css-loader'),
options: {
importLoaders: 1 + preProcessors.length,
sourceMap: true,
Expand Down
20 changes: 20 additions & 0 deletions packages/next/compiled/css-loader/LICENSE
@@ -0,0 +1,20 @@
Copyright JS Foundation and other contributors

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
'Software'), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1 change: 1 addition & 0 deletions packages/next/compiled/css-loader/api.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions packages/next/compiled/css-loader/cjs.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions packages/next/compiled/css-loader/getUrl.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions packages/next/compiled/css-loader/package.json
@@ -0,0 +1 @@
{"name":"css-loader","main":"cjs.js","author":"Tobias Koppers @sokra","license":"MIT"}
2 changes: 1 addition & 1 deletion packages/next/package.json
Expand Up @@ -75,7 +75,6 @@
"chalk": "2.4.2",
"chokidar": "3.5.1",
"crypto-browserify": "3.12.0",
"css-loader": "4.3.0",
"cssnano-simple": "1.2.1",
"etag": "1.8.1",
"find-cache-dir": "3.3.1",
Expand Down Expand Up @@ -187,6 +186,7 @@
"conf": "5.0.0",
"content-type": "1.0.4",
"cookie": "0.4.1",
"css-loader": "4.3.0",
"debug": "4.1.1",
"devalue": "2.0.1",
"escape-string-regexp": "2.0.0",
Expand Down
16 changes: 16 additions & 0 deletions packages/next/taskfile.js
Expand Up @@ -203,6 +203,21 @@ export async function ncc_cookie(task, opts) {
.target('compiled/cookie')
}
// eslint-disable-next-line camelcase
externals['css-loader'] = 'next/dist/compiled/css-loader'
export async function ncc_css_loader(task, opts) {
await task
.source(opts.src || relative(__dirname, require.resolve('css-loader')))
.ncc({
packageName: 'css-loader',
externals: {
...externals,
'schema-utils': 'next/dist/compiled/schema-utils',
},
target: 'es5',
})
.target('compiled/css-loader')
}
// eslint-disable-next-line camelcase
externals['debug'] = 'next/dist/compiled/debug'
export async function ncc_debug(task, opts) {
await task
Expand Down Expand Up @@ -669,6 +684,7 @@ export async function ncc(task) {
'ncc_conf',
'ncc_content_type',
'ncc_cookie',
'ncc_css_loader',
'ncc_debug',
'ncc_devalue',
'ncc_escape_string_regexp',
Expand Down

0 comments on commit 47ec677

Please sign in to comment.