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

[next] Absolute and HTTP asset URLs are not ignored #1632

Closed
sisou opened this issue Jan 15, 2020 · 2 comments
Closed

[next] Absolute and HTTP asset URLs are not ignored #1632

sisou opened this issue Jan 15, 2020 · 2 comments

Comments

@sisou
Copy link

sisou commented Jan 15, 2020

Version

16.0.0-alpha.2

Reproduction link

https://github.com/sisou/vue-next-webpack-preview

Steps to reproduce

  1. (Fork and) clone https://github.com/vuejs/vue-next-webpack-preview
  2. Run yarn upgrade to have the latest versions (e.g. vue-loader@16.0.0-alpha.2)
  3. Replace the relative src to the Vue logo in App.vue with a HTTP URL: https://vuejs.org/images/logo.png
  4. Try to compile with yarn dev or yarn build and receive an error.

What is expected?

The project compiles without errors, because absolute and HTTP URLs are ignored (or rather preserved-as-is) by vue-loader.

What is actually happening?

Vue-loader throws an error during compilation that it could not find dependencies.


I hope I have interpreted the Transform Rules correctly. I think I have, because it is working fine with Vue 2 and a lower version of vue-loader.

@sisou sisou changed the title Absolute and HTTP asset URLs are not ignored [next] Absolute and HTTP asset URLs are not ignored Jan 15, 2020
@sisou
Copy link
Author

sisou commented Jan 16, 2020

I did a bit more digging and I think this issue actually concerns the compiler-sfc package in vue-next, somewhere around this code:
https://github.com/vuejs/vue-next/blob/master/packages/compiler-sfc/src/templateTransformAssetUrl.ts#L49

The difference to Vue2 seems to be that there an import statement (a require) was only generated when the asset path was relative or prefixed with ~ or @ (https://github.com/vuejs/component-compiler-utils/blob/master/lib/templateCompilerModules/utils.ts#L17-L34), whereas now there is no such differentiation, as all URLs are parsed.

Do you want me to open an issue in vue-next instead?

@yyx990803
Copy link
Member

closed via vue-next#628

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants