Production Build Failed for Dynamic Import of `?raw` Files
See original GitHub issueDescribe the bug
I want to dynamically import content from a Markdown file, and use them as string. I won’t also know if the file exists or not.
Thus, with @patak-js’s help, I first created glob import of all the files in that folder and then customized the module created by glob import, by appending ?raw
to the import.
const docs = import.meta.glob("../models/docs/*/*.md");
Object.keys(docs).map((path) => (docs[path] = () => import(`${path}?raw`)));
fullPath = "somePathString";
docs[fullPath]().then(content => source.value = content.default);
During the development, this workaround works; however whenever those dynamically imports are triggered, I got a warning that Vite cannot analyze the dynamic import.
7:30:27 PM [vite] warning:
/Users/shein/kk/gh/uni5-ideal/src/components/ExternalMarkdown.vue
24 | ];
25 | const docs = import.meta.glob("../models/docs/*/*.md");
26 | Object.keys(docs).map((path) => docs[path] = () => import(`${path}?raw`));
| ^
27 | const source = ref("");
28 | const getSource = () => {
The above dynamic import cannot be analyzed by vite.
See https://github.com/rollup/plugins/tree/master/packages/dynamic-import-vars#limitations for supported dynamic import formats. If this is intended to be left as-is, you can use the /* @vite-ignore */ comment inside the import() call to suppress this warning.
Plugin: vite:import-analysis
File: /Users/shein/kk/gh/uni5-ideal/src/components/ExternalMarkdown.vue
So, I wondered if it is because the custom append on line does not satisfy the dynamic import format requirement. I fixed the customization above to below and the warning disappeared!
const docs = import.meta.glob("../models/docs/*/*.md");
Object.keys(docs).map((path) => (docs[path] = () => import(`../${path.slice(3, -3)}.md?raw`)));
fullPath = "somePathString";
docs[fullPath]().then(content => source.value = content.default);
However, in both of the above cases, I got the build error below.
➜ uni5-upstream git:(next) yarn build
yarn run v1.22.10
$ vite build
vite v2.2.3 building for production...
✓ 150 modules transformed.
[rollup-plugin-dynamic-import-variables] Unexpected token (1:0)
file: /Users/shein/kk/gh/uni5-upstream/src/models/docs/cn/AppAbout.md:1:0
error during build:
SyntaxError: Unexpected token (1:0)
at Object.pp$4.raise (/Users/shein/kk/gh/uni5-upstream/node_modules/rollup/dist/shared/rollup.js:15636:13)
at Object.pp.unexpected (/Users/shein/kk/gh/uni5-upstream/node_modules/rollup/dist/shared/rollup.js:13328:8)
at Object.pp$3.parseExprAtom (/Users/shein/kk/gh/uni5-upstream/node_modules/rollup/dist/shared/rollup.js:15035:10)
at Object.pp$3.parseExprSubscripts (/Users/shein/kk/gh/uni5-upstream/node_modules/rollup/dist/shared/rollup.js:14838:19)
at Object.pp$3.parseMaybeUnary (/Users/shein/kk/gh/uni5-upstream/node_modules/rollup/dist/shared/rollup.js:14815:17)
at Object.parseMaybeUnary (/Users/shein/kk/gh/uni5-upstream/node_modules/rollup/dist/shared/rollup.js:19581:29)
at Object.pp$3.parseExprOps (/Users/shein/kk/gh/uni5-upstream/node_modules/rollup/dist/shared/rollup.js:14750:19)
at Object.pp$3.parseMaybeConditional (/Users/shein/kk/gh/uni5-upstream/node_modules/rollup/dist/shared/rollup.js:14733:19)
at Object.pp$3.parseMaybeAssign (/Users/shein/kk/gh/uni5-upstream/node_modules/rollup/dist/shared/rollup.js:14701:19)
at Object.pp$3.parseExpression (/Users/shein/kk/gh/uni5-upstream/node_modules/rollup/dist/shared/rollup.js:14667:19)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
I tried it out with both Vite v2.0.5
and v2.2.3
, and the same behavior for both versions.
How can I resolve this issue and let me know if you need any more information from me to reproduce the issue.
Reproduction
https://github.com/Penguinlay/reproduction-viteDynamicImportBug
System Info
Output of npx envinfo --system --npmPackages vite,@vitejs/plugin-vue --binaries --browsers
:
System:
OS: macOS 11.4
CPU: (8) x64 Apple M1
Memory: 77.21 MB / 16.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 15.12.0 - /usr/local/bin/node
Yarn: 1.22.10 - /usr/local/bin/yarn
npm: 7.9.0 - /usr/local/bin/npm
Browsers:
Safari: 14.1.1
npmPackages:
@vitejs/plugin-vue: 1.2.1 => 1.2.1
vite: 2.2.3 => 2.2.3
Used package manager: yarn v1.22.10
Logs
yarn cache clean; rm -rf node_modules; rm yarn.lock; yarn; yarn vite --debug
➜ uni5-upstream git:(next) yarn cache clean; rm -rf node_modules; rm yarn.lock; yarn; yarn vite --debug
yarn cache v1.22.10
success Cleared cache.
✨ Done in 0.47s.
yarn install v1.22.10
info No lockfile found.
[1/4] 🔍 Resolving packages...
[2/4] 🚚 Fetching packages...
[3/4] 🔗 Linking dependencies...
warning "@intlify/vite-plugin-vue-i18n > @rollup/pluginutils@4.1.0" has unmet peer dependency "rollup@^1.20.0||^2.0.0".
warning " > sass-loader@10.1.1" has unmet peer dependency "webpack@^4.36.0 || ^5.0.0".
warning "vue-cli-plugin-vuetify > null-loader@3.0.0" has unmet peer dependency "webpack@^4.3.0".
[4/4] 🔨 Building fresh packages...
success Saved lockfile.
✨ Done in 12.19s.
yarn run v1.22.10
$ /Users/shein/kk/gh/uni5-upstream/node_modules/.bin/vite --debug
vite:config bundled config file loaded in 364ms +0ms
vite:config using resolved config: {
vite:config define: {
vite:config 'process.env': {},
vite:config 'import.meta.env.PACKAGE_VERSION': '"5.0.0-alpha.7"',
vite:config __VUE_OPTIONS_API__: true,
vite:config __VUE_PROD_DEVTOOLS__: false,
vite:config __VUE_I18N_LEGACY_API__: false,
vite:config __VUE_I18N_FULL_INSTALL__: false,
vite:config __VUE_I18N_PROD_DEVTOOLS__: false
vite:config },
vite:config plugins: [
vite:config 'vite:pre-alias',
vite:config 'alias',
vite:config 'vite:dynamic-import-polyfill',
vite:config 'vite:resolve',
vite:config 'vite:html',
vite:config 'vite:css',
vite:config 'vite:esbuild',
vite:config 'vite:json',
vite:config 'vite:wasm',
vite:config 'vite:worker',
vite:config 'vite:asset',
vite:config 'vite-plugin-package-version',
vite:config 'vite:vue',
vite:config 'vite-plugin-vue-i18n',
vite:config 'vite:define',
vite:config 'vite:css-post',
vite:config 'vite:client-inject',
vite:config 'vite:import-analysis'
vite:config ],
vite:config resolve: { dedupe: undefined, alias: [ [Object], [Object] ] },
vite:config server: {},
vite:config ssr: { external: [ 'vue', '@vue/server-renderer' ] },
vite:config configFile: '/Users/shein/kk/gh/uni5-upstream/vite.config.ts',
vite:config configFileDependencies: [ 'vite.config.ts' ],
vite:config inlineConfig: {
vite:config root: undefined,
vite:config base: undefined,
vite:config mode: undefined,
vite:config configFile: undefined,
vite:config logLevel: undefined,
vite:config clearScreen: undefined,
vite:config server: {}
vite:config },
vite:config root: '/Users/shein/kk/gh/uni5-upstream',
vite:config base: '/',
vite:config publicDir: '/Users/shein/kk/gh/uni5-upstream/public',
vite:config cacheDir: '/Users/shein/kk/gh/uni5-upstream/node_modules/.vite',
vite:config command: 'serve',
vite:config mode: 'development',
vite:config isProduction: false,
vite:config build: {
vite:config target: [ 'es2019', 'edge18', 'firefox60', 'chrome61', 'safari11' ],
vite:config polyfillDynamicImport: true,
vite:config outDir: 'dist',
vite:config assetsDir: 'assets',
vite:config assetsInlineLimit: 4096,
vite:config cssCodeSplit: true,
vite:config sourcemap: false,
vite:config rollupOptions: {},
vite:config commonjsOptions: { include: [Array], extensions: [Array] },
vite:config minify: 'terser',
vite:config terserOptions: {},
vite:config cleanCssOptions: {},
vite:config write: true,
vite:config emptyOutDir: null,
vite:config manifest: false,
vite:config lib: false,
vite:config ssr: false,
vite:config ssrManifest: false,
vite:config brotliSize: true,
vite:config chunkSizeWarningLimit: 500,
vite:config watch: null
vite:config },
vite:config env: { BASE_URL: '/', MODE: 'development', DEV: true, PROD: false },
vite:config assetsInclude: [Function: assetsInclude],
vite:config logger: {
vite:config hasWarned: false,
vite:config info: [Function: info],
vite:config warn: [Function: warn],
vite:config error: [Function: error],
vite:config clearScreen: [Function: clearScreen]
vite:config },
vite:config createResolver: [Function: createResolver]
vite:config } +4ms
vite:deps Crawling dependencies using entries:
vite:deps /Users/shein/kk/gh/uni5-upstream/index.html +0ms
vite:resolve 1ms /src/main.ts -> /Users/shein/kk/gh/uni5-upstream/src/main.ts +0ms
vite:resolve 2ms vue -> /Users/shein/kk/gh/uni5-upstream/node_modules/vue/dist/vue.runtime.esm-bundler.js +6ms
vite:resolve 1ms ./plugins/i18n -> /Users/shein/kk/gh/uni5-upstream/src/plugins/i18n/index.ts +2ms
vite:resolve 1ms ./plugins/store -> /Users/shein/kk/gh/uni5-upstream/src/plugins/store/index.ts +1ms
vite:resolve 0ms ./plugins/router -> /Users/shein/kk/gh/uni5-upstream/src/plugins/router/index.ts +0ms
vite:resolve 1ms ./plugins/axios -> /Users/shein/kk/gh/uni5-upstream/src/plugins/axios/index.ts +1ms
vite:resolve 0ms ./plugins/markdownIt -> /Users/shein/kk/gh/uni5-upstream/src/plugins/markdownIt/index.ts +0ms
vite:resolve 0ms ./App.vue -> /Users/shein/kk/gh/uni5-upstream/src/App.vue +0ms
vite:resolve 4ms vue-i18n/dist/vue-i18n.cjs.js -> /Users/shein/kk/gh/uni5-upstream/node_modules/vue-i18n/dist/vue-i18n.cjs.js +8ms
vite:resolve 4ms axios -> /Users/shein/kk/gh/uni5-upstream/node_modules/axios/index.js +0ms
vite:resolve 5ms vue-i18n -> /Users/shein/kk/gh/uni5-upstream/node_modules/vue-i18n/dist/vue-i18n.cjs.js +1ms
vite:resolve 3ms vue3-markdown-it -> /Users/shein/kk/gh/uni5-upstream/node_modules/vue3-markdown-it/dist/vue3-markdown-it.umd.min.js +3ms
vite:resolve 3ms vue-router -> /Users/shein/kk/gh/uni5-upstream/node_modules/vue-router/dist/vue-router.esm-bundler.js +0ms
vite:resolve 3ms vuex -> /Users/shein/kk/gh/uni5-upstream/node_modules/vuex/dist/vuex.esm-bundler.js +0ms
vite:resolve 3ms vue-axios -> /Users/shein/kk/gh/uni5-upstream/node_modules/vue-axios/dist/vue-axios.es5.js +0ms
vite:resolve 0ms ./routes -> /Users/shein/kk/gh/uni5-upstream/src/plugins/router/routes.ts +0ms
vite:resolve 1ms ../../models/datas/defaultApp -> /Users/shein/kk/gh/uni5-upstream/src/models/datas/defaultApp.ts +1ms
vite:resolve 0ms ../../scripts/gamesmanUni -> /Users/shein/kk/gh/uni5-upstream/src/scripts/gamesmanUni.ts +0ms
vite:resolve 0ms ../../components/TheHomePage.vue -> /Users/shein/kk/gh/uni5-upstream/src/components/TheHomePage.vue +1ms
vite:resolve 0ms ../../components/TheAboutPage.vue -> /Users/shein/kk/gh/uni5-upstream/src/components/TheAboutPage.vue +0ms
vite:resolve 0ms ../../components/ThePuzzlesPage.vue -> /Users/shein/kk/gh/uni5-upstream/src/components/ThePuzzlesPage.vue +1ms
vite:resolve 0ms ../../components/TheGamesPage.vue -> /Users/shein/kk/gh/uni5-upstream/src/components/TheGamesPage.vue +0ms
vite:resolve 0ms ../../components/TheVariantsPage.vue -> /Users/shein/kk/gh/uni5-upstream/src/components/TheVariantsPage.vue +0ms
vite:resolve 0ms ./apis/gamesCrafters -> /Users/shein/kk/gh/uni5-upstream/src/scripts/apis/gamesCrafters.ts +0ms
vite:resolve 0ms ../../components/TheGamePage.vue -> /Users/shein/kk/gh/uni5-upstream/src/components/TheGamePage.vue +0ms
vite:resolve 0ms ./apis/gitHub -> /Users/shein/kk/gh/uni5-upstream/src/scripts/apis/gitHub.ts +1ms
vite:resolve 0ms ../../components/TheUpdatesPage.vue -> /Users/shein/kk/gh/uni5-upstream/src/components/TheUpdatesPage.vue +0ms
vite:resolve 1ms ../../components/The404Page.vue -> /Users/shein/kk/gh/uni5-upstream/src/components/The404Page.vue +1ms
vite:deps Scan completed in 82ms: {
vue: '/Users/shein/kk/gh/uni5-upstream/node_modules/vue/dist/vue.runtime.esm-bundler.js',
axios: '/Users/shein/kk/gh/uni5-upstream/node_modules/axios/index.js',
'vue-i18n': '/Users/shein/kk/gh/uni5-upstream/node_modules/vue-i18n/dist/vue-i18n.cjs.js',
'vue3-markdown-it': '/Users/shein/kk/gh/uni5-upstream/node_modules/vue3-markdown-it/dist/vue3-markdown-it.umd.min.js',
'vue-router': '/Users/shein/kk/gh/uni5-upstream/node_modules/vue-router/dist/vue-router.esm-bundler.js',
vuex: '/Users/shein/kk/gh/uni5-upstream/node_modules/vuex/dist/vuex.esm-bundler.js',
'vue-axios': '/Users/shein/kk/gh/uni5-upstream/node_modules/vue-axios/dist/vue-axios.es5.js'
} +46ms
Pre-bundling dependencies:
vue
axios
vue-i18n
vue3-markdown-it
vue-router
(...and 2 more)
(this will be run only when your dependencies or config have changed)
vite:resolve 0ms @vue/runtime-dom -> null +0ms
vite:resolve 1ms @vue/runtime-dom -> /Users/shein/kk/gh/uni5-upstream/node_modules/@vue/runtime-dom/dist/runtime-dom.esm-bundler.js +0ms
vite:resolve 0ms @intlify/shared -> null +13ms
vite:resolve 1ms @intlify/shared -> /Users/shein/kk/gh/uni5-upstream/node_modules/@intlify/shared/dist/shared.esm-bundler.js +0ms
vite:resolve 0ms @intlify/core-base -> null +5ms
vite:resolve 1ms @intlify/core-base -> /Users/shein/kk/gh/uni5-upstream/node_modules/@intlify/core-base/dist/core-base.esm-bundler.js +4ms
vite:resolve 0ms @vue/runtime-core -> null +2ms
vite:resolve 0ms @vue/runtime-core -> /Users/shein/kk/gh/uni5-upstream/node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js +18ms
vite:resolve 0ms @vue/shared -> null +1ms
vite:resolve 0ms @vue/shared -> /Users/shein/kk/gh/uni5-upstream/node_modules/@vue/shared/dist/shared.esm-bundler.js +1ms
vite:resolve 0ms @intlify/message-resolver -> null +2ms
vite:resolve 0ms @intlify/message-resolver -> /Users/shein/kk/gh/uni5-upstream/node_modules/@intlify/message-resolver/dist/message-resolver.esm-bundler.js +2ms
vite:resolve 0ms @intlify/runtime -> null +1ms
vite:resolve 1ms @intlify/runtime -> /Users/shein/kk/gh/uni5-upstream/node_modules/@intlify/runtime/dist/runtime.esm-bundler.js +2ms
vite:resolve 0ms @intlify/message-compiler -> null +1ms
vite:resolve 1ms @intlify/message-compiler -> /Users/shein/kk/gh/uni5-upstream/node_modules/@intlify/message-compiler/dist/message-compiler.esm-bundler.js +1ms
vite:resolve 0ms @intlify/shared -> /Users/shein/kk/gh/uni5-upstream/node_modules/@intlify/shared/dist/shared.esm-bundler.js +0ms
vite:resolve 0ms @intlify/devtools-if -> null +2ms
vite:resolve 0ms @intlify/devtools-if -> /Users/shein/kk/gh/uni5-upstream/node_modules/@intlify/devtools-if/dist/devtools-if.esm-bundler.js +1ms
vite:resolve 0ms @vue/reactivity -> null +11ms
vite:resolve 1ms @vue/reactivity -> /Users/shein/kk/gh/uni5-upstream/node_modules/@vue/reactivity/dist/reactivity.esm-bundler.js +12ms
vite:deps deps bundled in 179ms +0ms
Port 3000 is in use, trying another one...
vite:deps Hash is consistent. Skipping. Use --force to override. +2ms
Port 3001 is in use, trying another one...
vite:deps Hash is consistent. Skipping. Use --force to override. +0ms
Port 3002 is in use, trying another one...
vite:deps Hash is consistent. Skipping. Use --force to override. +1ms
Port 3003 is in use, trying another one...
vite:deps Hash is consistent. Skipping. Use --force to override. +1ms
Port 3004 is in use, trying another one...
vite:deps Hash is consistent. Skipping. Use --force to override. +0ms
Port 3005 is in use, trying another one...
vite:deps Hash is consistent. Skipping. Use --force to override. +1ms
Port 3006 is in use, trying another one...
vite:deps Hash is consistent. Skipping. Use --force to override. +0ms
Port 3007 is in use, trying another one...
vite:deps Hash is consistent. Skipping. Use --force to override. +1ms
Port 3008 is in use, trying another one...
vite:deps Hash is consistent. Skipping. Use --force to override. +1ms
Port 3009 is in use, trying another one...
vite:deps Hash is consistent. Skipping. Use --force to override. +0ms
vite v2.2.3 dev server running at:
> Local: http://localhost:3010/
> Network: http://1.1.1.123:3010/
ready in 1167ms.
yarn cache clean; rm -rf node_modules; rm yarn.lock; yarn; yarn build --debug
➜ uni5-upstream git:(next) yarn cache clean; rm -rf node_modules; rm yarn.lock; yarn; yarn build --debug
yarn cache v1.22.10
success Cleared cache.
✨ Done in 0.46s.
yarn install v1.22.10
info No lockfile found.
[1/4] 🔍 Resolving packages...
[2/4] 🚚 Fetching packages...
[3/4] 🔗 Linking dependencies...
warning "@intlify/vite-plugin-vue-i18n > @rollup/pluginutils@4.1.0" has unmet peer dependency "rollup@^1.20.0||^2.0.0".
warning " > sass-loader@10.1.1" has unmet peer dependency "webpack@^4.36.0 || ^5.0.0".
warning "vue-cli-plugin-vuetify > null-loader@3.0.0" has unmet peer dependency "webpack@^4.3.0".
[4/4] 🔨 Building fresh packages...
success Saved lockfile.
✨ Done in 12.85s.
yarn run v1.22.10
$ vite build --debug
vite:config bundled config file loaded in 391ms +0ms
vite:config using resolved config: {
vite:config define: {
vite:config 'process.env': {},
vite:config 'import.meta.env.PACKAGE_VERSION': '"5.0.0-alpha.7"',
vite:config __VUE_OPTIONS_API__: true,
vite:config __VUE_PROD_DEVTOOLS__: false,
vite:config __VUE_I18N_LEGACY_API__: false,
vite:config __VUE_I18N_FULL_INSTALL__: false,
vite:config __VUE_I18N_PROD_DEVTOOLS__: false
vite:config },
vite:config plugins: [
vite:config 'alias',
vite:config 'vite:dynamic-import-polyfill',
vite:config 'vite:resolve',
vite:config 'vite:html',
vite:config 'vite:css',
vite:config 'vite:esbuild',
vite:config 'vite:json',
vite:config 'vite:wasm',
vite:config 'vite:worker',
vite:config 'vite:asset',
vite:config 'vite-plugin-package-version',
vite:config 'vite:vue',
vite:config 'vite-plugin-vue-i18n',
vite:config 'vite:define',
vite:config 'vite:css-post',
vite:config 'vite:build-html',
vite:config 'commonjs',
vite:config 'vite:data-uri',
vite:config 'rollup-plugin-dynamic-import-variables',
vite:config 'vite:import-analysis',
vite:config 'vite:esbuild-transpile',
vite:config 'vite:terser',
vite:config 'vite:reporter'
vite:config ],
vite:config resolve: { dedupe: undefined, alias: [ [Object], [Object] ] },
vite:config build: {
vite:config target: [ 'es2019', 'edge18', 'firefox60', 'chrome61', 'safari11' ],
vite:config polyfillDynamicImport: true,
vite:config outDir: 'dist',
vite:config assetsDir: 'assets',
vite:config assetsInlineLimit: 4096,
vite:config cssCodeSplit: true,
vite:config sourcemap: false,
vite:config rollupOptions: {},
vite:config commonjsOptions: { include: [Array], extensions: [Array] },
vite:config minify: 'terser',
vite:config terserOptions: {},
vite:config cleanCssOptions: {},
vite:config write: true,
vite:config emptyOutDir: null,
vite:config manifest: false,
vite:config lib: false,
vite:config ssr: false,
vite:config ssrManifest: false,
vite:config brotliSize: true,
vite:config chunkSizeWarningLimit: 500,
vite:config watch: null
vite:config },
vite:config ssr: { external: [ 'vue', '@vue/server-renderer' ] },
vite:config configFile: '/Users/shein/kk/gh/uni5-upstream/vite.config.ts',
vite:config configFileDependencies: [ 'vite.config.ts' ],
vite:config inlineConfig: {
vite:config root: undefined,
vite:config base: undefined,
vite:config mode: undefined,
vite:config configFile: undefined,
vite:config logLevel: undefined,
vite:config clearScreen: undefined,
vite:config build: {}
vite:config },
vite:config root: '/Users/shein/kk/gh/uni5-upstream',
vite:config base: '/',
vite:config publicDir: '/Users/shein/kk/gh/uni5-upstream/public',
vite:config cacheDir: '/Users/shein/kk/gh/uni5-upstream/node_modules/.vite',
vite:config command: 'build',
vite:config mode: 'production',
vite:config isProduction: true,
vite:config server: {},
vite:config env: { BASE_URL: '/', MODE: 'production', DEV: false, PROD: true },
vite:config assetsInclude: [Function: assetsInclude],
vite:config logger: {
vite:config hasWarned: false,
vite:config info: [Function: info],
vite:config warn: [Function: warn],
vite:config error: [Function: error],
vite:config clearScreen: [Function: clearScreen]
vite:config },
vite:config createResolver: [Function: createResolver]
vite:config } +4ms
vite v2.2.3 building for production...
✓ 151 modules transformed.
[rollup-plugin-dynamic-import-variables] Unexpected token (1:0)
file: /Users/shein/kk/gh/uni5-upstream/src/models/docs/cn/FileNotFound.md:1:0
error during build:
SyntaxError: Unexpected token (1:0)
at Object.pp$4.raise (/Users/shein/kk/gh/uni5-upstream/node_modules/rollup/dist/shared/rollup.js:15636:13)
at Object.pp.unexpected (/Users/shein/kk/gh/uni5-upstream/node_modules/rollup/dist/shared/rollup.js:13328:8)
at Object.pp$3.parseExprAtom (/Users/shein/kk/gh/uni5-upstream/node_modules/rollup/dist/shared/rollup.js:15035:10)
at Object.pp$3.parseExprSubscripts (/Users/shein/kk/gh/uni5-upstream/node_modules/rollup/dist/shared/rollup.js:14838:19)
at Object.pp$3.parseMaybeUnary (/Users/shein/kk/gh/uni5-upstream/node_modules/rollup/dist/shared/rollup.js:14815:17)
at Object.parseMaybeUnary (/Users/shein/kk/gh/uni5-upstream/node_modules/rollup/dist/shared/rollup.js:19581:29)
at Object.pp$3.parseExprOps (/Users/shein/kk/gh/uni5-upstream/node_modules/rollup/dist/shared/rollup.js:14750:19)
at Object.pp$3.parseMaybeConditional (/Users/shein/kk/gh/uni5-upstream/node_modules/rollup/dist/shared/rollup.js:14733:19)
at Object.pp$3.parseMaybeAssign (/Users/shein/kk/gh/uni5-upstream/node_modules/rollup/dist/shared/rollup.js:14701:19)
at Object.pp$3.parseExpression (/Users/shein/kk/gh/uni5-upstream/node_modules/rollup/dist/shared/rollup.js:14667:19)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Before submitting the issue, please make sure you do the following
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn’t already an issue that reports the same bug to avoid creating a duplicate.
- Provide a description in this issue that describes the bug.
- Make sure this is a Vite issue and not a framework-specific issue. For example, if it’s a Vue SFC related bug, it should likely be reported to https://github.com/vuejs/vue-next instead.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:7
- Comments:5 (1 by maintainers)
Top GitHub Comments
Have a same problem .
In production . ‘xxx?.raw’ can’t work correctly . May it’s can provide own
plugin-dynamic-import-vars
to fix the bug .Waiting for a solution 😃
Have same problem
“?raw” is not work on dynamic import in production mode, but it’s work on dev mode.
The main code to load the file: