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
Support packageOptions.rollup.plugins #3123
Conversation
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/pikapkg/snowpack/EuMTZTnRsYRVVtKExR1bGnh1oBVg |
Just curious: what are you using this for? Starting in Snowpack v3.2, we send all dependencies through your normal source build pipeline. We were only aware of rollup plugins being used to get around that limitation, back when dependencies weren't sent through your normal build pipeline. |
@FredKSchott After I upgrade to 3.1.2, the scss files in node_modules fails in build #2970, and the same problems like #2999. I found the packageOptions.rollup.plugins didn't work any more. In 3.0.11 I use packageOptions.rollup.plugins to deal with the scss files in node_modules, and it works well. So I create this PR. Did you mean I should add those plugins to the Thanks for you great work, I love snowpack 👍 |
@FredKSchott I didn't see anything about sending all deps through the normal build pipeline in the changelog for 3.2, did you mean a different version or did it simply sneak out of the changelog? 🙃 |
But It doesn't work : ( |
@haruhihi Sorry for the unexpected change. Which npm packages are you having issues with? And are you able to provide a reproduction of the issue? As Fred said, the |
I believe this happened under #2707 as part of |
@drwpow The issue here #2970 #2999. The npm package is belong to my company, I can't put it here. I will try to find an open source package to reproduce later. Seems the plugin for .scss, .svg doesn't work on node_modules. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could maybe use deepmerge as in config.ts
@@ -52,6 +52,7 @@ export async function installPackages({ | |||
stats: false, | |||
rollup: { | |||
plugins: [ | |||
...(installOptions?.rollup?.plugins ?? []), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
first ?. is useless
@@ -575,6 +575,9 @@ export class PackageSourceLocal implements PackageSource { | |||
if (config.packageOptions.namedExports !== undefined) { | |||
installOptions.namedExports = config.packageOptions.namedExports; | |||
} | |||
if (config.packageOptions.rollup !== undefined) { | |||
installOptions.rollup = config.packageOptions.rollup; | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the root cause of this bug seems to be that confusing redundancy between call site and function body
@FredKSchott @drwpow this bug seems critical.. or maybe I missed something.. it blocks me trying to rewrite css urls via a plugin of a rollup plugin (rollup-plugin-postcss) |
Yeah that’s fair. I wanted to believe that the correct fix was to run Snowpack plugins over all node_modules, and deprecate this option. But after reflecting on it, I’m happy to merge it, because in all cases I think removing Rollup plugins for now would be a breaking change. It’s still in our docs, after all. |
I'll do. Actually, I thinked it was the default behaviour to apply plugins on all files. |
@drwpow @eytienne Thanks, After upgrade I see the plugins works :) . But I get another problem now. The
I see there are four single quotes around |
Changes
Testing
Docs