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
80ed74bc
Commit
80ed74bc
authored
Jan 16, 2020
by
Josh Larson
Committed by
Joe Haddad
Jan 16, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add specific warning for require() PostCSS plugin (#10121)
parent
57ec121d
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
58 additions
and
0 deletions
+58
-0
plugins.ts
packages/next/build/webpack/config/blocks/css/plugins.ts
+9
-0
index.test.js
test/integration/css-customization/test/index.test.js
+17
-0
_app.js
...css-fixtures/bad-custom-configuration-arr-8/pages/_app.js
+12
-0
index.js
...ss-fixtures/bad-custom-configuration-arr-8/pages/index.js
+3
-0
postcss.config.js
...fixtures/bad-custom-configuration-arr-8/postcss.config.js
+3
-0
global.css
...fixtures/bad-custom-configuration-arr-8/styles/global.css
+14
-0
No files found.
packages/next/build/webpack/config/blocks/css/plugins.ts
View file @
80ed74bc
...
@@ -193,6 +193,15 @@ export async function getPostCssPlugins(
...
@@ -193,6 +193,15 @@ export async function getPostCssPlugins(
}
}
throw
new
Error
(
genericErrorText
)
throw
new
Error
(
genericErrorText
)
}
}
}
else
if
(
typeof
plugin
===
'function'
)
{
console
.
error
(
`
${
chalk
.
red
.
bold
(
'Error'
)}
: A PostCSS Plugin was passed as a function using require(), but it must be provided as a
${
chalk
.
bold
(
'string'
)}
.`
)
throw
new
Error
(
genericErrorText
)
}
else
{
}
else
{
console
.
error
(
console
.
error
(
`
${
chalk
.
red
.
bold
(
`
${
chalk
.
red
.
bold
(
...
...
test/integration/css-customization/test/index.test.js
View file @
80ed74bc
...
@@ -331,6 +331,23 @@ describe('Bad CSS Customization Array (7)', () => {
...
@@ -331,6 +331,23 @@ describe('Bad CSS Customization Array (7)', () => {
})
})
})
})
describe
(
'Bad CSS Customization Array (8)'
,
()
=>
{
const
appDir
=
join
(
fixturesDir
,
'bad-custom-configuration-arr-8'
)
beforeAll
(
async
()
=>
{
await
remove
(
join
(
appDir
,
'.next'
))
})
it
(
'should fail the build'
,
async
()
=>
{
const
{
stderr
}
=
await
nextBuild
(
appDir
,
[],
{
stderr
:
true
})
expect
(
stderr
).
toMatch
(
/A PostCSS Plugin was passed as a function using require
\(\)
, but it must be provided as a string/
)
expect
(
stderr
).
toMatch
(
/Build error occurred/
)
})
})
describe
(
'Bad CSS Customization Function'
,
()
=>
{
describe
(
'Bad CSS Customization Function'
,
()
=>
{
const
appDir
=
join
(
fixturesDir
,
'bad-custom-configuration-func'
)
const
appDir
=
join
(
fixturesDir
,
'bad-custom-configuration-func'
)
...
...
test/integration/css-fixtures/bad-custom-configuration-arr-8/pages/_app.js
0 → 100644
View file @
80ed74bc
import
React
from
'react'
import
App
from
'next/app'
import
'../styles/global.css'
class
MyApp
extends
App
{
render
()
{
const
{
Component
,
pageProps
}
=
this
.
props
return
<
Component
{...
pageProps
}
/
>
}
}
export
default
MyApp
test/integration/css-fixtures/bad-custom-configuration-arr-8/pages/index.js
0 → 100644
View file @
80ed74bc
export
default
function
Home
()
{
return
<
div
/>
}
test/integration/css-fixtures/bad-custom-configuration-arr-8/postcss.config.js
0 → 100644
View file @
80ed74bc
module
.
exports
=
{
plugins
:
[
require
(
'postcss-trolling'
)],
}
test/integration/css-fixtures/bad-custom-configuration-arr-8/styles/global.css
0 → 100644
View file @
80ed74bc
/* this should pass through untransformed */
@media
(
480px
<=
width
<
768px
)
{
a
::
before
{
content
:
''
;
}
::placeholder
{
color
:
green
;
}
}
/* this should be transformed to width/height */
.video
{
-xyz-max-size
:
400rem
300rem
;
}
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