Next.js 9 with antd + less, yarn build get an error
See original GitHub issueQUESTION
yarn dev
is work, but yarn build
get an error.
> Build error occurred
{ /<PROJECT-PATH>/node_modules/antd/lib/style/index.less:1
(function (exports, require, module, __filename, __dirname) { @import './themes/index';
^
SyntaxError: Invalid or unexpected token
at new Script (vm.js:79:7)
at createScript (vm.js:251:10)
at Object.runInThisContext (vm.js:303:10)
at Module._compile (internal/modules/cjs/loader.js:656:28)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
at Module.load (internal/modules/cjs/loader.js:598:32)
at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
at Function.Module._load (internal/modules/cjs/loader.js:529:3)
at Module.require (internal/modules/cjs/loader.js:636:17)
at require (internal/modules/cjs/helpers.js:20:18) type: 'SyntaxError', '$error': '$error' }
error Command failed with exit code 1.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:18
- Comments:30 (4 by maintainers)
Top Results From Across the Web
How to configure nextjs 9 and ant design less compatibility?
It seems there is a compatibility problem with ant design and I found some sources but not get it though! reactjs · next.js...
Read more >How to use Ant Design with Next.js
Install Ant Design. We can install Ant Design to our Next.js app with a single command: yarn add antd.
Read more >next-transpile-modules
I have trouble with transpilation and my custom .babelrc. If you get a transpilation error when using a custom Babel configuration, make sure ......
Read more >Building Forms with Next.js
Learn how to create forms with Next.js, from the form HTML element to advanced concepts ... i.e., GET or POST used to send...
Read more >Next JS with Ant Design
Getting Started · Add ant design package yarn add antd · Add other ant design dependencies for next js like zeit/css, ziet/less and...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
RESOLVE
i found that with-ant-design-less can handles this error, but project/pages’s less style don’t work. so I wrote a
next-antd.config.js
to solve this problem.next.config.js
next-antd.config.js
.babelrc.js
package.json
Here are the files that works fine for me :
next.config.js
.babelrc