-
I am getting this issues when I add
yarn add vuepress-vite@next
export default {
bundler: "@vuepress/vite",
}
echo "```\nprocess.env.NODE_ENV\n```" > docs/README.md
yarn vuepress build I am not sure where this bug comes from, can you provide some help? @meteorlxy Mini repro: https://github.com/nsznsznjsz/vuepress-next-repro-env-variable
Details: yarn run v1.22.10
$ vuepress build docs
info Initializing VuePress and preparing data...
⠹ Compiling with vite[rollup-plugin-dynamic-import-variables] Unexpected token (6:44)
file: /home/cedar/src/vuepress-next-repro-env-variable/docs/.vuepress/.temp/pages/index.html.vue:6:44
✖ Compiling with vite - failed
SyntaxError: Unexpected token (6:44)
at Parser.pp$4.raise (/home/cedar/src/vuepress-next-repro-env-variable/node_modules/rollup/dist/shared/rollup.js:15872:13)
at Parser.pp.unexpected (/home/cedar/src/vuepress-next-repro-env-variable/node_modules/rollup/dist/shared/rollup.js:13382:8)
at Parser.pp.expect (/home/cedar/src/vuepress-next-repro-env-variable/node_modules/rollup/dist/shared/rollup.js:13376:26)
at Parser.pp$3.parseExprList (/home/cedar/src/vuepress-next-repro-env-variable/node_modules/rollup/dist/shared/rollup.js:15741:12)
at Parser.pp$3.parseSubscript (/home/cedar/src/vuepress-next-repro-env-variable/node_modules/rollup/dist/shared/rollup.js:15106:25)
at Parser.pp$3.parseSubscripts (/home/cedar/src/vuepress-next-repro-env-variable/node_modules/rollup/dist/shared/rollup.js:15063:24)
at Parser.pp$3.parseExprSubscripts (/home/cedar/src/vuepress-next-repro-env-variable/node_modules/rollup/dist/shared/rollup.js:15047:21)
at Parser.pp$3.parseMaybeUnary (/home/cedar/src/vuepress-next-repro-env-variable/node_modules/rollup/dist/shared/rollup.js:15010:17)
at Parser.pp$3.parseExprOps (/home/cedar/src/vuepress-next-repro-env-variable/node_modules/rollup/dist/shared/rollup.js:14943:19)
at Parser.pp$3.parseMaybeConditional (/home/cedar/src/vuepress-next-repro-env-variable/node_modules/rollup/dist/shared/rollup.js:14926:19)
fatal error: all goroutines are asleep - deadlock!
goroutine 1 [semacquire]:
sync.runtime_Semacquire(0xc000014d68)
runtime/sema.go:56 +0x45
sync.(*WaitGroup).Wait(0xc000014d60)
sync/waitgroup.go:130 +0x65
main.runService(0x7ffc0bdf7901)
github.com/evanw/esbuild/cmd/esbuild/service.go:138 +0x63b
main.main()
github.com/evanw/esbuild/cmd/esbuild/main.go:189 +0x3e5
goroutine 5 [chan receive]:
main.runService.func1(0xc00006c190, 0xc000014d60)
github.com/evanw/esbuild/cmd/esbuild/service.go:66 +0x4a
created by main.runService
github.com/evanw/esbuild/cmd/esbuild/service.go:64 +0x1f1
goroutine 6 [chan receive]:
main.(*serviceType).sendRequest(0xc00006c190, 0x870300, 0xc0000119e0, 0x7, 0xc000110868)
github.com/evanw/esbuild/cmd/esbuild/service.go:163 +0x11e
main.runService.func2(0xc00006c190)
github.com/evanw/esbuild/cmd/esbuild/service.go:92 +0x47
created by main.runService
github.com/evanw/esbuild/cmd/esbuild/service.go:89 +0x6c5
goroutine 7 [chan receive]:
github.com/evanw/esbuild/internal/bundler.(*scanner).scanAllDependencies(0xc0001fe380)
github.com/evanw/esbuild/internal/bundler/bundler.go:1494 +0x11d
github.com/evanw/esbuild/internal/bundler.ScanBundle(0x5, 0xc0001c1110, 0xc0001980f0, 0xc000198108, 0xc0001963c0, 0x97d660, 0xc0001882c0, 0x97aa98, 0xc0001fe000, 0xc000184660, ...)
github.com/evanw/esbuild/internal/bundler/bundler.go:1002 +0x4e9
github.com/evanw/esbuild/pkg/api.rebuildImpl(0x2, 0x0, 0x5, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
github.com/evanw/esbuild/pkg/api/api_impl.go:950 +0x23c8
github.com/evanw/esbuild/pkg/api.buildImpl(0x2, 0x0, 0x5, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
github.com/evanw/esbuild/pkg/api/api_impl.go:714 +0x5ae
github.com/evanw/esbuild/pkg/api.Build(...)
github.com/evanw/esbuild/pkg/api/api.go:334
main.(*serviceType).handleBuildRequest(0xc00006c190, 0xc000000000, 0xc00018c060, 0x7, 0xc000192198, 0xc00018c060, 0x1)
github.com/evanw/esbuild/cmd/esbuild/service.go:454 +0x878
main.(*serviceType).handleIncomingPacket(0xc00006c190, 0xc000166500, 0x4e7, 0x500, 0x0, 0x0, 0x0, 0x0)
github.com/evanw/esbuild/cmd/esbuild/service.go:192 +0x5f5
main.runService.func3(0xc00006c190, 0xc000166500, 0x4e7, 0x500, 0xc000014d60)
github.com/evanw/esbuild/cmd/esbuild/service.go:123 +0x53
created by main.runService
github.com/evanw/esbuild/cmd/esbuild/service.go:122 +0x347
goroutine 49 [chan receive]:
main.(*serviceType).sendRequest(0xc00006c190, 0x870300, 0xc0004344e0, 0xa, 0xc0002af4f8)
github.com/evanw/esbuild/cmd/esbuild/service.go:163 +0x11e
main.(*serviceType).convertPlugins.func2.2(0xc0003446a0, 0x10, 0xc0002fc000, 0x59, 0x8df0eb, 0x4, 0xc0002fc000, 0x52, 0x1, 0x0, ...)
github.com/evanw/esbuild/cmd/esbuild/service.go:682 +0x728
github.com/evanw/esbuild/pkg/api.(*pluginImpl).OnResolve.func1(0xc0003446a0, 0x10, 0xc0002fc000, 0x59, 0x8df0eb, 0x4, 0x0, 0x0, 0x0, 0xc0002fc000, ...)
github.com/evanw/esbuild/pkg/api/api_impl.go:1442 +0x1d5
github.com/evanw/esbuild/internal/bundler.runOnResolvePlugins(0xc000184600, 0x1, 0x1, 0x97aa98, 0xc0001fe000, 0x5, 0xc0001c1110, 0xc0001980f0, 0xc000198108, 0xc0001963c0, ...)
github.com/evanw/esbuild/internal/bundler/bundler.go:682 +0xa55
github.com/evanw/esbuild/internal/bundler.parseFile(0x97d660, 0xc0001882c0, 0x5, 0xc0001c1110, 0xc0001980f0, 0xc000198108, 0xc0001963c0, 0x97aa98, 0xc0001fe000, 0xc000184660, ...)
github.com/evanw/esbuild/internal/bundler/bundler.go:389 +0xcd7
created by github.com/evanw/esbuild/internal/bundler.(*scanner).maybeParseFile
github.com/evanw/esbuild/internal/bundler/bundler.go:1103 +0x5f8
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
It seems that the source of the bug has been found, this is a expected behavior for vite/rollup, there is also has a workaround, |
Beta Was this translation helpful? Give feedback.
-
It's a known "issue" of vite. All defined variables will be statically replaced during build. FYI: https://vitejs.dev/guide/env-and-mode.html If you are insterested, try using bundler-vite to build the official docs, which will fail...:sweat_smile: |
Beta Was this translation helpful? Give feedback.
It's a known "issue" of vite. All defined variables will be statically replaced during build.
FYI: https://vitejs.dev/guide/env-and-mode.html
If you are insterested, try using bundler-vite to build the official docs, which will fail...:sweat_smile: