Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
CoCo_Code_Op2
next.js
提交
fc98c13a
N
next.js
项目概览
CoCo_Code_Op2
/
next.js
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
N
next.js
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
fc98c13a
编写于
8月 20, 2020
作者:
J
Joe Haddad
提交者:
GitHub
8月 20, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Warn on duplicate Sass deps (#16398)
Fixes #13953
上级
3dec5000
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
82 addition
and
0 deletion
+82
-0
errors/duplicate-sass.md
errors/duplicate-sass.md
+33
-0
packages/next/cli/next-dev.ts
packages/next/cli/next-dev.ts
+12
-0
test/integration/cli/duplicate-sass/.gitignore
test/integration/cli/duplicate-sass/.gitignore
+1
-0
test/integration/cli/duplicate-sass/node_modules/node-sass/index.js
...ration/cli/duplicate-sass/node_modules/node-sass/index.js
+1
-0
test/integration/cli/duplicate-sass/node_modules/node-sass/package.json
...on/cli/duplicate-sass/node_modules/node-sass/package.json
+4
-0
test/integration/cli/duplicate-sass/node_modules/sass/index.js
...integration/cli/duplicate-sass/node_modules/sass/index.js
+1
-0
test/integration/cli/duplicate-sass/node_modules/sass/package.json
...gration/cli/duplicate-sass/node_modules/sass/package.json
+4
-0
test/integration/cli/duplicate-sass/package.json
test/integration/cli/duplicate-sass/package.json
+6
-0
test/integration/cli/duplicate-sass/pages/index.js
test/integration/cli/duplicate-sass/pages/index.js
+3
-0
test/integration/cli/test/index.test.js
test/integration/cli/test/index.test.js
+17
-0
未找到文件。
errors/duplicate-sass.md
0 → 100644
浏览文件 @
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
浏览文件 @
fc98c13a
...
...
@@ -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
...
...
test/integration/cli/duplicate-sass/.gitignore
0 → 100644
浏览文件 @
fc98c13a
!node_modules
test/integration/cli/duplicate-sass/node_modules/node-sass/index.js
0 → 100644
浏览文件 @
fc98c13a
module
.
exports
=
{}
test/integration/cli/duplicate-sass/node_modules/node-sass/package.json
0 → 100644
浏览文件 @
fc98c13a
{
"name"
:
"node-sass"
,
"version"
:
"1.0.0"
}
test/integration/cli/duplicate-sass/node_modules/sass/index.js
0 → 100644
浏览文件 @
fc98c13a
module
.
exports
=
{}
test/integration/cli/duplicate-sass/node_modules/sass/package.json
0 → 100644
浏览文件 @
fc98c13a
{
"name"
:
"sass"
,
"version"
:
"1.0.0"
}
test/integration/cli/duplicate-sass/package.json
0 → 100644
浏览文件 @
fc98c13a
{
"dependencies"
:
{
"node-sass"
:
"*"
,
"sass"
:
"*"
}
}
test/integration/cli/duplicate-sass/pages/index.js
0 → 100644
浏览文件 @
fc98c13a
export
default
function
Home
()
{
return
<
p
>
Hello
<
/p
>
}
test/integration/cli/test/index.test.js
浏览文件 @
fc98c13a
...
...
@@ -18,6 +18,7 @@ const dirOldReact = join(__dirname, '../old-react')
const
dirOldReactDom
=
join
(
__dirname
,
'
../old-react-dom
'
)
const
dirExperimentalReact
=
join
(
__dirname
,
'
../experimental-react
'
)
const
dirExperimentalReactDom
=
join
(
__dirname
,
'
../experimental-react-dom
'
)
const
dirDuplicateSass
=
join
(
__dirname
,
'
../duplicate-sass
'
)
describe
(
'
CLI Usage
'
,
()
=>
{
describe
(
'
no command
'
,
()
=>
{
...
...
@@ -295,6 +296,22 @@ describe('CLI Usage', () => {
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
'
,
()
=>
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录