nuxi build -> ERROR Rollup error: Unexpected token
See original GitHub issueEnvironment
- Operating System:
Darwin
- Node Version:
v17.3.1
- Nuxt Version:
3.0.0-rc.3-27571095.9379606
- Package Manager:
yarn@1.22.17
- Builder:
vite
- User Config:
extends
,buildModules
,build
,ssr
- Runtime Modules:
-
- Build Modules:
@nuxt/content@2.0.0
Reproduction
I’ve started incorporating nuxt/modules
into my nuxt3 project. I am unable to build (SSR false or true) I get the following error
$ nuxi build
Nuxt CLI v3.0.0-rc.3-27571095.9379606 17:44:38
✔ Using ~/components/content for components in Markdown @nuxt/content 17:44:39
ℹ Vite client warmed up in 789ms 17:44:41
ℹ Client built in 2677ms 17:44:43
ℹ Building server... 17:44:43
✔ Server built in 1068ms 17:44:44
✔ Generated public .output/public nitro 17:44:44
ℹ Initializing prerenderer nitro 17:44:44
ℹ Prerendering 4 routes nitro 17:44:45
├─ / (8ms) nitro 17:44:45
├─ /200 (1ms) nitro 17:44:45
├─ /404 (0ms) nitro 17:44:45
├─ /api/_content/cache (149ms) nitro 17:44:46
start Building server... nitro 17:44:46
ERROR Rollup error: Unexpected token (Note that you need plugins to import files that are not JavaScript) nitro 17:44:46
ERROR Unexpected token (Note that you need plugins to import files that are not JavaScript) 17:44:46
at error (node_modules/rollup/dist/es/shared/rollup.js:1840:30)
at Module.error (node_modules/rollup/dist/es/shared/rollup.js:12528:16)
at Module.tryParse (node_modules/rollup/dist/es/shared/rollup.js:12905:25)
at Module.setSource (node_modules/rollup/dist/es/shared/rollup.js:12810:24)
at ModuleLoader.addModuleSource (node_modules/rollup/dist/es/shared/rollup.js:22284:20)
error Command failed with exit code 1.
Describe the bug
if I comment out the following line in nuxt.config file then I’m able the error is gone
import { defineNuxtConfig } from 'nuxt'
export default defineNuxtConfig({
modules: ['@nuxt/content'], // commenting out this line fixes the issue
})
Additional context
No response
Logs
No response
Issue Analytics
- State:
- Created a year ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Nuxt3 nuxi build ERROR [commonjs--resolver] - Stack Overflow
When i run nuxi dev everything is Ok, but nuxi build occurred this error. > @ build E:\everyday-action\webprint > nuxi build Nuxi 3.0.0...
Read more >@rollup/plugin-typescript - npm
If a type error is detected, the Rollup build is aborted when this option is set to true. files , include , exclude....
Read more >rollup failed to resolve import "react-dom/client" - You.com
Getting This problem Failed to resolve import "react-dom/client" from "src\main.jsx". Does the file exist? this is my main.jsx file import React from 'react' ......
Read more >Configuring Vite
Using these as variable names will result in an error: ... and build when building for production ( vite build ). ... rollupOptions.output...
Read more >0 1 "[rollup-plugin-dynamic-import-variables] Unexpected ...
npm run build. I get an error like: [rollup-plugin-dynamic-import-variables] Unexpected token (25:51) file: /home/alein10/Desktop/Sam ...
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
Well I think using
'
is definetely not a best practice for filenames. Maybe we could find a way to warn this to improve the DX @farnabaz ?This may comme from one of your Markdown files, can you try to remove them and add them one by one by and building to see which one is causing it?