Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
fc98c13a
Unverified
Commit
fc98c13a
authored
Aug 20, 2020
by
Joe Haddad
Committed by
GitHub
Aug 20, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Warn on duplicate Sass deps (#16398)
Fixes #13953
parent
3dec5000
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
82 additions
and
0 deletions
+82
-0
duplicate-sass.md
errors/duplicate-sass.md
+33
-0
next-dev.ts
packages/next/cli/next-dev.ts
+12
-0
.gitignore
test/integration/cli/duplicate-sass/.gitignore
+1
-0
index.js
...ration/cli/duplicate-sass/node_modules/node-sass/index.js
+1
-0
package.json
...on/cli/duplicate-sass/node_modules/node-sass/package.json
+4
-0
index.js
...integration/cli/duplicate-sass/node_modules/sass/index.js
+1
-0
package.json
...gration/cli/duplicate-sass/node_modules/sass/package.json
+4
-0
package.json
test/integration/cli/duplicate-sass/package.json
+6
-0
index.js
test/integration/cli/duplicate-sass/pages/index.js
+3
-0
index.test.js
test/integration/cli/test/index.test.js
+17
-0
No files found.
errors/duplicate-sass.md
0 → 100644
View file @
fc98c13a
# Duplicate Sass Dependencies
#### Why This Error Occurred
Your project has a direct dependency on both
`sass`
and
`node-sass`
, two
different package that both compile Sass files!
Next.js will only use one of these, so it is suggested you remove one or the
other.
#### Possible Ways to Fix It
The
`sass`
package is a modern implementation of Sass in JavaScript that
supports all the new features and does not require any native dependencies.
Since
`sass`
is now the canonical implementation, we suggest removing the older
`node-sass`
package, which should speed up your builds and project install time.
**Via npm**
```
bash
npm uninstall node-sass
```
**Via Yarn**
```
bash
yarn remove node-sass
```
### Useful Links
-
[
`sass` package documentation
](
https://github.com/sass/dart-sass
)
packages/next/cli/next-dev.ts
View file @
fc98c13a
...
@@ -91,6 +91,18 @@ const nextDev: cliCommand = (argv) => {
...
@@ -91,6 +91,18 @@ const nextDev: cliCommand = (argv) => {
)
)
}
}
}
}
const
[
sassVersion
,
nodeSassVersion
]
=
await
Promise
.
all
([
getPackageVersion
({
cwd
:
dir
,
name
:
'sass'
}),
getPackageVersion
({
cwd
:
dir
,
name
:
'node-sass'
}),
])
if
(
sassVersion
&&
nodeSassVersion
)
{
Log
.
warn
(
'Your project has both `sass` and `node-sass` installed as dependencies, but should only use one or the other. '
+
'Please remove the `node-sass` dependency from your project. '
+
' Read more: https://err.sh/next.js/duplicate-sass'
)
}
}
}
const
port
=
args
[
'--port'
]
||
3000
const
port
=
args
[
'--port'
]
||
3000
...
...
test/integration/cli/duplicate-sass/.gitignore
0 → 100644
View file @
fc98c13a
!node_modules
test/integration/cli/duplicate-sass/node_modules/node-sass/index.js
0 → 100644
View file @
fc98c13a
module
.
exports
=
{}
test/integration/cli/duplicate-sass/node_modules/node-sass/package.json
0 → 100644
View file @
fc98c13a
{
"name"
:
"node-sass"
,
"version"
:
"1.0.0"
}
test/integration/cli/duplicate-sass/node_modules/sass/index.js
0 → 100644
View file @
fc98c13a
module
.
exports
=
{}
test/integration/cli/duplicate-sass/node_modules/sass/package.json
0 → 100644
View file @
fc98c13a
{
"name"
:
"sass"
,
"version"
:
"1.0.0"
}
test/integration/cli/duplicate-sass/package.json
0 → 100644
View file @
fc98c13a
{
"dependencies"
:
{
"node-sass"
:
"*"
,
"sass"
:
"*"
}
}
test/integration/cli/duplicate-sass/pages/index.js
0 → 100644
View file @
fc98c13a
export
default
function
Home
()
{
return
<
p
>
Hello
<
/p
>
}
test/integration/cli/test/index.test.js
View file @
fc98c13a
...
@@ -18,6 +18,7 @@ const dirOldReact = join(__dirname, '../old-react')
...
@@ -18,6 +18,7 @@ const dirOldReact = join(__dirname, '../old-react')
const
dirOldReactDom
=
join
(
__dirname
,
'../old-react-dom'
)
const
dirOldReactDom
=
join
(
__dirname
,
'../old-react-dom'
)
const
dirExperimentalReact
=
join
(
__dirname
,
'../experimental-react'
)
const
dirExperimentalReact
=
join
(
__dirname
,
'../experimental-react'
)
const
dirExperimentalReactDom
=
join
(
__dirname
,
'../experimental-react-dom'
)
const
dirExperimentalReactDom
=
join
(
__dirname
,
'../experimental-react-dom'
)
const
dirDuplicateSass
=
join
(
__dirname
,
'../duplicate-sass'
)
describe
(
'CLI Usage'
,
()
=>
{
describe
(
'CLI Usage'
,
()
=>
{
describe
(
'no command'
,
()
=>
{
describe
(
'no command'
,
()
=>
{
...
@@ -295,6 +296,22 @@ describe('CLI Usage', () => {
...
@@ -295,6 +296,22 @@ describe('CLI Usage', () => {
await
killApp
(
instance
)
await
killApp
(
instance
)
})
})
test
(
'duplicate sass deps'
,
async
()
=>
{
const
port
=
await
findPort
()
let
stderr
=
''
let
instance
=
await
launchApp
(
dirDuplicateSass
,
port
,
{
stderr
:
true
,
onStderr
(
msg
)
{
stderr
+=
msg
},
})
expect
(
stderr
).
toMatch
(
'both `sass` and `node-sass` installed'
)
await
killApp
(
instance
)
})
})
})
describe
(
'export'
,
()
=>
{
describe
(
'export'
,
()
=>
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment