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

Incorrect svg filepath #2736

Closed
wesflynn opened this issue Mar 7, 2019 · 8 comments · Fixed by #2740
Closed

Incorrect svg filepath #2736

wesflynn opened this issue Mar 7, 2019 · 8 comments · Fixed by #2740

Comments

@wesflynn
Copy link

wesflynn commented Mar 7, 2019

🐛 bug report

After updating to the latest version of Parcel (1.12.0) svg images no longer load properly due to the wrong paths being generated.

🎛 Configuration (.babelrc, package.json, cli command)

{
  "presets": ["@babel/env", "@babel/react"],
  "plugins": ["@babel/plugin-proposal-class-properties","react-hot-loader/babel","@babel/plugin-transform-runtime"]
}

🤔 Expected Behavior

Generated links should look like:

<img alt="logo" src="./logo_color.7e674228.svg" class="Component-logo-64">

😯 Current Behavior

Links generated by the newest version of Parcel:

<img alt="logo" src="/....logo_color.7e674228.svg" class="Component-logo-64">

💁 Possible Solution

🔦 Context

💻 Code Sample

import logo from "./Images/logo_color.svg";
...
<img alt={"logo"} src={logo} className={classes.logo} />

🌍 Your Environment

Software Version(s)
Parcel
Node
npm/Yarn
Operating System
@mischnic
Copy link
Member

mischnic commented Mar 7, 2019

Could you please post the img tag of your source code (esp. the src tag)?

@wesflynn
Copy link
Author

wesflynn commented Mar 7, 2019

alright here's what my source looks like...

import logo from "./Images/logo_color.svg";
...
<img alt={"logo"} src={logo} className={classes.logo} />

budparr pushed a commit to theNewDynamic/thenewdynamic.org that referenced this issue Mar 8, 2019
Parcel parcel-bundler/parcel#2740

parcel-bundler/parcel#2736

also removed --experimental-scope-hoisting until upgrade works
kkoskelin added a commit to flexion/ef-cms that referenced this issue Mar 8, 2019
kkoskelin added a commit to flexion/ef-cms that referenced this issue Mar 8, 2019
@GioLogist
Copy link

+1

@garth
Copy link

garth commented Mar 11, 2019

This issue seems to affect all asset types that are referenced from css, not just svg. The files are output correctly into the build folder but the paths in the css are output in a relative format instead of absolute as specified by --public-url.

Had to revert back to v1.11 for now.

@GioLogist
Copy link

For added context, I also received this error when referencing an img via require

@VincentGJ
Copy link

+1

@philcockfield
Copy link

+1

philcockfield added a commit to uiharness/uiharness that referenced this issue Mar 12, 2019
@herkyl
Copy link

herkyl commented Mar 22, 2020

Seeing similar behaviour in Parcel 1.12.4.

Using CSS I'm importing an svg like so url('../assets/icon.svg')
The minified svg file gets put to the root dist directory however the the minified CSS file tries to load it from dist/style/

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