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

Replace node-sass test dependency with sass #39053

Merged
merged 3 commits into from Jul 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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.