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
assert { type: 'json' }
results in "Error: Unexpected token"
#4530
Comments
Just found this plugin which fixes this issue: https://github.com/swiing/rollup-plugin-import-assertions No idea what your roadmap is like though, whether you want this as a plugin or if it ought to just work in core, so I'll leave this open. |
There is an older issue for the topic: #3799 The plan is definitely to support them eventually. It is just not clear how to do it at the moment, there are some scenarios that need to be cleared up:
|
Initial support in #4646 |
This issue has been resolved via #4646 as part of rollup@3.0.0-8. Note that this is a pre-release, so to test it, you need to install Rollup via |
This issue has been resolved via #4646 as part of rollup@3.0.0. You can test it via |
Rollup Version
2.75.6
Operating System (or Browser)
macOS Monterey
Node Version (if applicable)
16.15.1
Link To Reproduction
https://rollupjs.org/repl/?version=2.75.6&shareable=JTdCJTIybW9kdWxlcyUyMiUzQSU1QiU3QiUyMm5hbWUlMjIlM0ElMjJtYWluLmpzJTIyJTJDJTIyY29kZSUyMiUzQSUyMmltcG9ydCUyMGRhdGElMjBmcm9tJTIwJTVDJTIydGVzdC1qc29uLWltcG9ydCUyRmRhdGEuanNvbiU1QyUyMiUyMGFzc2VydCUyMCU3QiUyMHR5cGUlM0ElMjAlNUMlMjJqc29uJTVDJTIyJTIwJTdEJTNCJTVDbiU1Q25jb25zb2xlLnRhYmxlKGRhdGEpJTNCJTIyJTJDJTIyaXNFbnRyeSUyMiUzQXRydWUlN0QlMkMlN0IlMjJuYW1lJTIyJTNBJTIyZGF0YS5qc29uJTIyJTJDJTIyY29kZSUyMiUzQSUyMiU3QiU1Q24lMjAlMjAlMjAlMjAlNUMlMjJpZCU1QyUyMiUzQSUyMDElNUNuJTdEJTIyJTdEJTVEJTJDJTIyb3B0aW9ucyUyMiUzQSU3QiUyMmZvcm1hdCUyMiUzQSUyMmVzJTIyJTJDJTIybmFtZSUyMiUzQSUyMm15QnVuZGxlJTIyJTJDJTIyYW1kJTIyJTNBJTdCJTIyaWQlMjIlM0ElMjIlMjIlN0QlMkMlMjJnbG9iYWxzJTIyJTNBJTdCJTdEJTdEJTJDJTIyZXhhbXBsZSUyMiUzQW51bGwlN0Q=
Expected Behaviour
When
index.js
includesassert { type: 'json'}
on an import, and I runyarn rollup index.js
it should not error.This includes both non-npm module json files:
And those in an npm module:
https://nodejs.org/docs/latest-v16.x/api/esm.html#json-modules
Also see this minimal reproduction repo: https://github.com/cmcculloh/rollup-import-json
Actual Behaviour
Rollup errors on the
assert
The text was updated successfully, but these errors were encountered: