Closed DunhamGitHub closed 1 month ago
May likely be related to https://github.com/vitejs/vite/pull/14221
Not sure it's entirely the same, but i got an error at build time too with latest 5.3.0:
error during build:
src/modules/app/routeConfig/Settings/index.ts (7:21): Unexpected token `string literal (, "")`. Expected yield, an identifier, [ or { (Note that you need plugins to import files that are not JavaScript)
file: /home/runner/work/proj/proj/src/modules/app/routeConfig/Settings/index.ts:7:21
5: name: 'Settings',
6: path: 'admin',
7: getComponent: () => import(/* webpackChunkName: "admin" */ './SettingsContainer').then(mod => mod.default),
^
8: disabled: ['drawer', 'default_header', 'header'],
9: children: [
RollupError: Unexpected token `string literal (, "")`. Expected yield, an identifier, [ or {
at getRollupError (file:///home/runner/work/proj/proj/node_modules/rollup/dist/es/shared/parseAst.js:396:41)
at ParseError.initialise (file:///home/runner/work/proj/proj/node_modules/rollup/dist/es/shared/node-entry.js:11332:28)
at convertNode (file:///home/runner/work/proj/proj/node_modules/rollup/dist/es/shared/node-entry.js:13082:10)
at convertProgram (file:///home/runner/work/proj/proj/node_modules/rollup/dist/es/shared/node-entry.js:12399:12)
at Module.setSource (file:///home/runner/work/proj/proj/node_modules/rollup/dist/es/shared/node-entry.js:14246:24)
at async ModuleLoader.addModuleSource (file:///home/runner/work/proj/proj/node_modules/rollup/
(Searching recent commits brought me here)
I am not sure if I am hitting exactly the same issue, but I saw a very similar output:
Expected ',', got '[' (Note that you need plugins to import files that are not JavaScript)
The syntax that is broken is from a codemirror package:
LanguageDescription.of({
name: "Go",
extensions: ["go"],
load() {
return import("@codemirror/lang-go").then(m => m.go())
}
}),
Full code could be found here: https://github.com/codemirror/language-data/blob/main/src/language-data.ts
More interestingly, if I changed the syntax to something like this:
LanguageDescription.of({
name: "Go",
extensions: ["go"],
load() {
return import("@codemirror/lang-go").then(m => { return m.go() })
}
}),
It can build without any problem. However I will then hit a runtime error: ReferenceError: Can't find variable: __VITE_PRELOAD__
.
I am not sure if it's related to https://github.com/vitejs/vite/pull/14221 or https://github.com/vitejs/vite/pull/16562 cc @bluwy just in case you have any insights, thanks.
@cyanzhong Can you open a new issue with a repro using codemirror? I tested locally and can't bring up any errors.
@bluwy Thank you for your quick response. Yeah I've figured out a bit more info and opened https://github.com/vitejs/vite/issues/17478.
The __VITE_PRELOAD__
error is related https://github.com/vitejs/vite/pull/16562 but it's a problem of the https://github.com/richardtallent/vite-plugin-singlefile plugin, I've opened a PR there.
Thank you!
Describe the bug
running ionic build with vite 5.3.0 gives error, 5.2.11 works.
Reproduction
......
Steps to reproduce
in package.json use vite: "vite": "5.3.0"
and now with vite 5.2.11
System Info
Used Package Manager
npm
Logs
No response
Validations