-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
*.json files with no validKeys
blow up TypeError: Cannot read property '0' of null
in ExportDefaultDeclaration.prototype.render
#1146
Comments
TypeError: Cannot read property '0' of null
in ExportDefaultDeclaration.prototype.rendervalidKeys
blow up TypeError: Cannot read property '0' of null
in ExportDefaultDeclaration.prototype.render
When I changed ExportDefaultDeclaration I assumed that acorn would produce the AST. But it appears that the AST is generated by rollup-plugin-json in this case and something is amiss. Can you confirm that this rollup patch fixes the problem for you? --- a/src/ast/nodes/ExportDefaultDeclaration.js
+++ b/src/ast/nodes/ExportDefaultDeclaration.js
@@ -53,7 +53,7 @@ export default class ExportDefaultDeclaration extends Node {
let declaration_start;
if ( this.declaration ) {
const statementStr = code.original.slice( this.start, this.end );
- declaration_start = this.start + statementStr.match(/^export\s+default\s*/)[0].length;
+ declaration_start = this.start + statementStr.match(/^\s*export\s+default\s+/)[0].length;
}
if ( this.shouldInclude || this.declaration.activated ) { If it doesn't work could you please post the value of |
Likely fix: #1152 |
Fixed on both ends now, so I'll close this |
Regular user here reporting. been using Rollup for over a year with Gulp.
And this is the function inside my gulpfile which I wrote to do the rollups:
Error stack mentioned line
Why do I get this error now? |
Fixed in 0.40.1 Allow missing space between export default and declaration (#1218) |
I'm packaging an import from mime-db, which loads a json file.
https://github.com/jshttp/mime-db/blob/master/db.json
Stack trace
Cannot read property '0' of null
TypeError: Cannot read property '0' of null
at ExportDefaultDeclaration.render (/home/user/project/node_modules/rollup/src/ast/nodes/ExportDefaultDeclaration.js:57:4)
at Module.render (/home/user/project/node_modules/rollup/src/Module.js:320:8)
at /home/user/project/node_modules/rollup/src/Bundle.js:376:17
at Array.forEach (native)
at Bundle.render (/home/user/project/node_modules/rollup/src/Bundle.js:375:16)
at generate (/home/user/project/node_modules/rollup/src/rollup.js:75:30)
at Object.result.write (/home/user/project/node_modules/rollup/src/rollup.js:103:9)
at /home/user/project/node_modules/rollup-watch/dist/rollup-watch.cjs.js:162:21
Type rollup --help for help, or visit https://github.com/rollup/rollup/wiki
See rollup/rollup-plugin-json#19
The text was updated successfully, but these errors were encountered: