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

Parcel build - svg is generated like JS files and not working after html open #41

Open
fadrnym opened this issue Oct 30, 2023 · 6 comments

Comments

@fadrnym
Copy link

fadrnym commented Oct 30, 2023

Hello,
I have a problem with the parcel build, when after building the URL changes to html and the link points to JS files that are not working. please advise how to solve it.? Everything is fine in development mode.

For example, I tried the starter pack here: https://github.com/Nikolasgrizli/Starter-parcel and it doesn't work either.

Thank you very much.

Mirek

My parcelrc file:

{ "extends": "@parcel/config-default", "namers": ["parcel-namer-rewrite"], "transformers": { "*.twig": ["@christian-beckmann/parcel-transformer-twig"], "*.svg": ["parcel-transformer-svg-sprite"] }, "packagers": { "*.html": "parcel-packager-svg-sprite" } }

@Epimodev
Copy link
Owner

Hi @fadrnym

It's been a long time I didn't work with Parcel but I thought the last version for parcel v2 worked fine even for build.

I'll try tomorrow to be sure.

@fadrnym
Copy link
Author

fadrnym commented Oct 30, 2023

@Epimodev thak you very much. I have parcel v2 there, but unfortunately it doesn't work

@fadrnym
Copy link
Author

fadrnym commented Oct 31, 2023

@Epimodev - Hello, some information for me? :) Thank you very much.

@Epimodev
Copy link
Owner

Hi @fadrnym
I was working for a client all day long so I wasn't able to test earlier.

But I just found a moment to test and I can confirm the plugin works for dev and build.
I don't know why it doesn't work for you, but I think it comes from a conflict with @christian-beckmann/parcel-transformer-twig, because parcel-packager-svg-sprite makes html manipulation to inject svg sprite.

As I don't use anymore parcel for years and I'm very busy on other projects, I'll not be able to take more time for this.
But I created this project which use this plugin and works well (but without twig). https://github.com/Epimodev/poc-parcel2-plugin

Sorry for not being able to help more on this

gldenis added a commit to gldenis/parcel-plugin-svg-sprite that referenced this issue Jan 20, 2024
Fixed the svg icons for the build task (svg href was not replaced by xlink:href because there were wrong keys in the svgBundles object )
@gldenis
Copy link
Contributor

gldenis commented Jan 20, 2024

Hi, @Epimodev
I fixed this problem, please confirm my pull request #42. so that people can use the package and not create a new npm package.

Epimodev pushed a commit that referenced this issue Jan 22, 2024
Fixed the svg icons for the build task (svg href was not replaced by xlink:href because there were wrong keys in the svgBundles object )
@Epimodev
Copy link
Owner

Thanks a lot @gldenis,
I just published parcel-packager-svg-sprite and parcel-transformer-svg-sprite to version 2.0.1 on npm.
https://www.npmjs.com/package/parcel-packager-svg-sprite?activeTab=versions
https://www.npmjs.com/package/parcel-transformer-svg-sprite?activeTab=versions

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

3 participants