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
Add option to ignore warnings #198
Conversation
We had discussed about the warning a while ago and agreed to remove it altogether, so another option here is not needed. vite-plugin-svelte had already done so at sveltejs/vite-plugin-svelte#272. This is also in my todo list for rollup-plugin-svelte but never got to it. Feel free to tackle it if you like. Besides removing the warning, we also need to manually read the |
Ok. I'm not super confident in the inner workings of this, but I've made a few changes now to port the recursive check from vite-plugin-svelte. Perhaps that will ease the workload for you? |
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.
Some small requests, but overall this looks great to me. cc @dominikg
README.md
Outdated
// Ignore warnings regarding packages not exporting their package.json file | ||
// by adding the package name to this array. | ||
ignoreExportsWarn: []; | ||
|
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.
This can be removed now
index.d.ts
Outdated
|
||
/** Ignore warnings regarding packages not exporting their package.json file | ||
* by adding the package name to this array. | ||
*/ | ||
ignoreExportsWarn: string[]; |
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.
And this too
index.js
Outdated
} catch (err) { | ||
if (err.code === 'MODULE_NOT_FOUND') return {pkg: null, dir}; | ||
if (err.code === 'ERR_PACKAGE_PATH_NOT_EXPORTED') { | ||
dir = path.dirname(relative.resolve(name)); |
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.
dir = path.dirname(relative.resolve(name)); | |
dir = path.dirname(relative.resolve(name, path.dirname(importer)); |
I think we need to specify the importer too. Perhaps we can abstract this as a function since it's used in the try block too.
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.
Cool. One more thing I forgot to mention, all variables and function names has to be in snake_case if they are not public API, e.g. parse_pkg
, find_pkg
, get_dir
, etc
this looks ok for me, would be great to validate that it works as expected on windows. The logic of resolving the "svelte" field in package.json isn't really bundler dependant so i wonder if this was something that could/should live in it's own package to be reusable? (out of scope for this PR) |
This PR adds an option in rollup.config.js to ignore warnings about package.json not being exported. See discussion in #181.