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

TypeError: Cannot read property 'start' of null #2381

Closed
steve-taylor opened this issue Aug 6, 2018 · 4 comments · Fixed by #2384
Closed

TypeError: Cannot read property 'start' of null #2381

steve-taylor opened this issue Aug 6, 2018 · 4 comments · Fixed by #2384

Comments

@steve-taylor
Copy link

steve-taylor commented Aug 6, 2018

  • Rollup Version (if applicable): 0.63.4
  • Operating System (or Browser): macOS High Sierra
  • Node Version: 10.5.0
  • NPM Version: 6.1.0

How Do We Reproduce?

git clone https://github.com/finalforum/finalforum
cd finalforum
git checkout 9d2bb38428798b61efe80a05febee9d4e93cb549
npm ci
npm run build-client

Expected Behavior

It rolls up my code into dist/client-bundle.js.

Actual Behavior

It produces the following error:

[!] TypeError: Cannot read property 'start' of null
TypeError: Cannot read property 'start' of null
    at ConditionalExpression.render (/path/to/finalforum/finalforum/node_modules/rollup/dist/rollup.js:10536:53)
    at BinaryExpression.NodeBase.render (/path/to/finalforum/finalforum/node_modules/rollup/dist/rollup.js:9240:23)
    at CallExpression.NodeBase.render (/path/to/finalforum/finalforum/node_modules/rollup/dist/rollup.js:9236:31)
    at CallExpression.NodeBase.render (/path/to/finalforum/finalforum/node_modules/rollup/dist/rollup.js:9236:31)
    at VariableDeclarator.NodeBase.render (/path/to/finalforum/finalforum/node_modules/rollup/dist/rollup.js:9240:23)
    at VariableDeclaration$$1.render (/path/to/finalforum/finalforum/node_modules/rollup/dist/rollup.js:12375:28)
    at renderStatementList (/path/to/finalforum/finalforum/node_modules/rollup/dist/rollup.js:3836:25)
    at BlockStatement$$1.render (/path/to/finalforum/finalforum/node_modules/rollup/dist/rollup.js:9977:13)
    at IfStatement.render (/path/to/finalforum/finalforum/node_modules/rollup/dist/rollup.js:10839:33)
    at renderStatementList (/path/to/finalforum/finalforum/node_modules/rollup/dist/rollup.js:3836:25)

which seems to be related to #2134 and fixed in #2146 (0.58.2).

@steve-taylor
Copy link
Author

Downgrading styled-components from 3.4.1 to 3.3.3 fixes it.

When I upgrade from 3.3.3 to 3.4.0, I get this new warning:

(!) Missing shims for Node.js built-ins
Creating a browser bundle that depends on 'stream'. You might need to include https://www.npmjs.com/package/rollup-plugin-node-builtins
(!) Unresolved dependencies
https://github.com/rollup/rollup/wiki/Troubleshooting#treating-module-as-external-dependency
stream (imported by node_modules/styled-components/dist/styled-components.browser.esm.js)
(!) Missing global variable name
Use output.globals to specify browser global variable names corresponding to external modules
stream (guessing 'stream')

I added rollup-plugin-node-globals and rollup-plugin-node-builtins (in that order) as the last two plugins and the warning went away.

I then upgraded styled-components from 3.4.0 to 3.4.1 and the error returned.

So I think this is an issue with both styled-components 3.4.1 and Rollup. The issue with Rollup is a lack of useful error messaging in this case.

@lukastaegert
Copy link
Member

Fix at #2384

@steve-taylor
Copy link
Author

Awesome! I'll try it out as soon as I can.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants