Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SSR] Template asset imported inside a router-link gives error during build #2034

Closed
3 tasks done
ghost opened this issue Feb 15, 2021 · 0 comments
Closed
3 tasks done

Comments

@ghost
Copy link

ghost commented Feb 15, 2021

⚠️ IMPORTANT ⚠️ Please check the following list before proceeding. If you ignore this issue template, your issue will be directly closed.

  • Read the docs.
  • Use Vite >=2.0. (1.x is no longer supported)
  • If the issue is related to 1.x -> 2.0 upgrade, read the Migration Guide first.

Describe the bug

Inserting an asset reference url (like a img tag with a src attribute) in a template inside a router-link tag returns an error at build time and prevent build from completion.

Reproduction

I created a repository so you can try this up. Instructions are in the README file

https://github.com/desys-tambellini/vite-bug-example

System Info

  • vite version: 2.0.0-beta.69
  • Operating System: Windows
  • Node version: v14.15.4
  • Package manager (npm/yarn/pnpm) and version: npm 7.5.3

Logs (Optional if provided reproduction)

$ vite build --debug --ssr src/entry-server.js --outDir dist/server
  vite:config cjs config loaded in 412ms +0ms
  vite:config using resolved 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:vue',
  vite:config     'vue-jsx',
  vite:config     'virtual',
  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:reporter'
  vite:config   ],
  vite:config   build: {
  vite:config     target: [ 'es2019', 'edge16', 'firefox60', 'chrome61', 'safari11' ],
  vite:config     polyfillDynamicImport: true,
  vite:config     outDir: 'dist/server',
  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: false,
  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: 'src/entry-server.js',
  vite:config     ssrManifest: false,
  vite:config     brotliSize: true,
  vite:config     chunkSizeWarningLimit: 500
  vite:config   },
  vite:config   define: { __VUE_OPTIONS_API__: true, __VUE_PROD_DEVTOOLS__: false },
  vite:config   ssr: { external: [ 'vue', '@vue/server-renderer' ] },
  vite:config   esbuild: { include: /\.ts$/ },
  vite:config   configFile: 'C:/Users/s.tambellini/Downloads/vite-bug-example/vite-bug-example/vite.config.js',
  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: { ssr: 'src/entry-server.js', outDir: 'dist/server' }
  vite:config   },
  vite:config   root: 'C:/Users/s.tambellini/Downloads/vite-bug-example/vite-bug-example',
  vite:config   base: '/',
  vite:config   resolve: { dedupe: undefined, alias: [ [Object] ] },
  vite:config   publicDir: 'C:\\Users\\s.tambellini\\Downloads\\vite-bug-example\\vite-bug-example\\public',
  vite:config   command: 'build',
  vite:config   mode: 'production',
  vite:config   isProduction: true,
  vite:config   optimizeCacheDir: 'C:\\Users\\s.tambellini\\Downloads\\vite-bug-example\\vite-bug-example\\node_modules\\.vite',
  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 } +10ms
building SSR bundle for production...
  vite:deps Crawling dependencies using entries:
  vite:deps   C:/Users/s.tambellini/Downloads/vite-bug-example/vite-bug-example/index.html
  vite:deps   C:/Users/s.tambellini/Downloads/vite-bug-example/vite-bug-example/dist/client/index.html +0ms
  vite:resolve 2ms   /src/entry-client.js -> C:/Users/s.tambellini/Downloads/vite-bug-example/vite-bug-example/src/entry-client.js +0ms
  vite:resolve 2ms   /assets/index.b8135103.js -> null +4ms
  vite:resolve 1ms   ./main -> C:/Users/s.tambellini/Downloads/vite-bug-example/vite-bug-example/src/main.js +110ms
  vite:resolve 0ms   ./App.vue -> C:/Users/s.tambellini/Downloads/vite-bug-example/vite-bug-example/src/App.vue +148ms
  vite:resolve 4ms   vue -> C:/Users/s.tambellini/Downloads/vite-bug-example/vite-bug-example/node_modules/vue/dist/vue.runtime.esm-bundler.js +7ms
  vite:resolve 0ms   ./router -> C:/Users/s.tambellini/Downloads/vite-bug-example/vite-bug-example/src/router.js +3ms
  vite:resolve 5ms   vue-router -> C:/Users/s.tambellini/Downloads/vite-bug-example/vite-bug-example/node_modules/vue-router/dist/vue-router.esm-bundler.js +15ms
  vite:resolve 2ms   ./pages/About.vue -> C:/Users/s.tambellini/Downloads/vite-bug-example/vite-bug-example/src/pages/About.vue +108ms
  vite:resolve 1ms   ./pages/Home.vue -> C:/Users/s.tambellini/Downloads/vite-bug-example/vite-bug-example/src/pages/Home.vue +2ms
  vite:resolve 1ms   ../components/Foo -> C:/Users/s.tambellini/Downloads/vite-bug-example/vite-bug-example/src/components/Foo.jsx +10ms
  vite:deps Scan completed in 1330ms: {
  vue: 'C:/Users/s.tambellini/Downloads/vite-bug-example/vite-bug-example/node_modules/vue/dist/vue.runtime.esm-bundler.js',
  'vue-router': 'C:/Users/s.tambellini/Downloads/vite-bug-example/vite-bug-example/node_modules/vue-router/dist/vue-router.esm-bundler.js'
} +1s
✓ 2 modules transformed.
[rollup-plugin-dynamic-import-variables] Identifier '_imports_0' has already been declared (5:7)
file: C:/Users/s.tambellini/Downloads/vite-bug-example/vite-bug-example/src/App.vue:5:7
error during build:
SyntaxError: Identifier '_imports_0' has already been declared (5:7)
    at Object.pp$4.raise (C:\Users\s.tambellini\Downloads\vite-bug-example\vite-bug-example\node_modules\rollup\dist\shared\rollup.js:15849:13)
    at Object.pp$5.declareName (C:\Users\s.tambellini\Downloads\vite-bug-example\vite-bug-example\node_modules\rollup\dist\shared\rollup.js:15923:26)
    at Object.pp$2.checkLValSimple (C:\Users\s.tambellini\Downloads\vite-bug-example\vite-bug-example\node_modules\rollup\dist\shared\rollup.js:14739:48)
    at Object.pp$1.parseImportSpecifiers (C:\Users\s.tambellini\Downloads\vite-bug-example\vite-bug-example\node_modules\rollup\dist\shared\rollup.js:14428:10)
    at Object.pp$1.parseImport (C:\Users\s.tambellini\Downloads\vite-bug-example\vite-bug-example\node_modules\rollup\dist\shared\rollup.js:14412:28)
    at Object.pp$1.parseStatement (C:\Users\s.tambellini\Downloads\vite-bug-example\vite-bug-example\node_modules\rollup\dist\shared\rollup.js:13715:47)
    at Object.pp$1.parseTopLevel (C:\Users\s.tambellini\Downloads\vite-bug-example\vite-bug-example\node_modules\rollup\dist\shared\rollup.js:13598:21)
    at Object.parse (C:\Users\s.tambellini\Downloads\vite-bug-example\vite-bug-example\node_modules\rollup\dist\shared\rollup.js:13400:15)
    at Function.parse (C:\Users\s.tambellini\Downloads\vite-bug-example\vite-bug-example\node_modules\rollup\dist\shared\rollup.js:13421:35)
    at Object.Graph.contextParse [as parse] (C:\Users\s.tambellini\Downloads\vite-bug-example\vite-bug-example\node_modules\rollup\dist\shared\rollup.js:19126:70)
error Command failed with exit code 1.

Thank you for your time

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.