Skip to content

Commit

Permalink
Replace node-sass test dependency with sass (#39053)
Browse files Browse the repository at this point in the history
* Replace node-sass test dependency with sass

* breakup css/scss tests for more parallelism

* update compiled
  • Loading branch information
ijjk committed Jul 27, 2022
1 parent c3e5caf commit 90ddd0d
Show file tree
Hide file tree
Showing 9 changed files with 1,279 additions and 1,347 deletions.
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -159,7 +159,6 @@
"next": "workspace:*",
"node-fetch": "2.6.7",
"node-notifier": "8.0.1",
"node-sass": "6.0.1",
"npm-run-all": "4.1.5",
"nprogress": "0.2.0",
"pixrem": "5.0.0",
Expand All @@ -186,6 +185,7 @@
"release": "6.3.1",
"request-promise-core": "1.1.2",
"resolve-from": "5.0.0",
"sass": "1.54.0",
"seedrandom": "3.0.5",
"selenium-webdriver": "4.0.0-beta.4",
"semver": "7.3.7",
Expand Down
2 changes: 1 addition & 1 deletion packages/next/compiled/sass-loader/cjs.js

Large diffs are not rendered by default.

21 changes: 14 additions & 7 deletions packages/next/taskfile.js
Expand Up @@ -1473,15 +1473,22 @@ export async function copy_react_server_dom_webpack(task, opts) {
// eslint-disable-next-line camelcase
externals['sass-loader'] = 'next/dist/compiled/sass-loader'
export async function ncc_sass_loader(task, opts) {
const sassLoaderPath = require.resolve('sass-loader')
const utilsPath = join(dirname(sassLoaderPath), 'utils.js')
const originalContent = await fs.readFile(utilsPath, 'utf8')

await fs.writeFile(
utilsPath,
originalContent.replace(
/require\.resolve\(["'](sass|node-sass)["']\)/g,
'eval("require").resolve("$1")'
)
)

await task
.source(opts.src || relative(__dirname, require.resolve('sass-loader')))
.source(opts.src || relative(__dirname, sassLoaderPath))
.ncc({
packageName: 'sass-loader',
customEmit(path, isRequire) {
if (isRequire && path === 'sass') return false
if (path.indexOf('node-sass') !== -1)
return `eval("require.resolve('node-sass')")`
},
externals: {
...externals,
'schema-utils': externals['schema-utils3'],
Expand Down Expand Up @@ -1854,7 +1861,6 @@ export async function ncc(task, opts) {
'ncc_postcss_modules_values',
'ncc_postcss_value_parser',
'ncc_icss_utils',
'ncc_sass_loader',
'ncc_schema_utils2',
'ncc_schema_utils3',
'ncc_semver',
Expand Down Expand Up @@ -1888,6 +1894,7 @@ export async function ncc(task, opts) {
'copy_constants_browserify',
'copy_react_server_dom_webpack',
'copy_react_is',
'ncc_sass_loader',
'ncc_jest_worker',
'ncc_edge_runtime_primitives',
'ncc_edge_runtime',
Expand Down
147 changes: 17 additions & 130 deletions pnpm-lock.yaml

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

0 comments on commit 90ddd0d

Please sign in to comment.