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

Regression in v1.12.0 release #2859

Closed
maxmilton opened this issue May 15, 2019 · 7 comments · Fixed by #2861
Closed

Regression in v1.12.0 release #2859

maxmilton opened this issue May 15, 2019 · 7 comments · Fixed by #2861

Comments

@maxmilton
Copy link

  • Rollup Version: v1.12.0
  • Operating System (or Browser): Ubuntu 19.04; Linux max 5.0.0-15-generic #16-Ubuntu SMP Mon May 6 17:41:33 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
  • Node Version: tested with v10.15.3, v11.15.0, and v12.2.0

How Do We Reproduce?

  1. For an existing project which breaks see https://github.com/MaxMilton/new-tab.
  2. Clone a copy of master locally and install dependencies.
  3. Run either yarn run build or yarn run dev, both break in different ways 😬

Both npm and yarn produce the same result.

I'll to create a more minimal repo in a moment and try dig a little deeper into what might be going wrong.

Expected Behavior

Build runs to completion as in rollup v1.11.3.

Actual Behavior

Note: This is from the project mentioned above which uses a bunch of rollup plugins so the following might not be very concise. Will post back once I can repro with a minimal example.

`yarn run dev` (expand me):
> new-tab@0.14.0 dev /media/max/xps-linux/home/max/Projects/new-tab
> rollup --config --watch

[!] ReferenceError: Cannot access 'processConfigsErr' before initialization
ReferenceError: Cannot access 'processConfigsErr' before initialization
    at /media/max/xps-linux/home/max/Projects/new-tab/node_modules/rollup/bin/rollup:1457:35
    at Array.map (<anonymous>)
    at processConfigs (/media/max/xps-linux/home/max/Projects/new-tab/node_modules/rollup/bin/rollup:1441:24)
    at watch (/media/max/xps-linux/home/max/Projects/new-tab/node_modules/rollup/bin/rollup:1433:28)
    at execute (/media/max/xps-linux/home/max/Projects/new-tab/node_modules/rollup/bin/rollup:1662:9)
    at /media/max/xps-linux/home/max/Projects/new-tab/node_modules/rollup/bin/rollup:1653:30

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! new-tab@0.14.0 dev: `rollup --config --watch`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the new-tab@0.14.0 dev script.
`yarn run build` (expand me):
yarn run v1.16.0
$ rm -rf dist && mkdir dist && cp icon* dist
$ NODE_ENV=production rollup --config

src/app.ts → dist/n.js...
[!] Error: Unexpected token (Note that you need plugins to import files that are not JavaScript)
src/App.css (1:0)
1: :root{--s:0 2px 4px rgba(0,0,17,0.15);--b:#fafafa;--t:#383a42;--c:#e5e5e6;--c0:#fff;--c1:#dbdbdc;--c2:#eef0f2}.d{--b:#23252d;--t:#9da5b4;--c:#21252b;--c0:#292d35;--c1:#383e4a;--c2:#292d35}body{margin:80px 0;font-size:18px;line-height:41px;text-rendering:optimizeSpeed;font-variant-ligatures:none;color:var(--t);background-color:var(--b)}.muted,h2{color:var(--c1)}a{text-decoration:none}a:focus,a:hover{text-decoration:underline}
   ^
2: /*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjpudWxsLCJzb3VyY2VzIjpbIi9tZWRpYS9tYXgveHBzLWxpbnV4L2hvbWUvbWF4L1Byb2plY3RzL25ldy10YWIvc3JjL0FwcC5zdmVsdGUiXSwic291cmNlc0NvbnRlbnQiOlsiPHNjcmlwdD5cbiAgaW1wb3J0IHsgaGFuZGxlTGlua0NsaWNrIH0gZnJvbSAnLi9jb21tb24nO1xuICBpbXBvcnQgQm9va21hcmtHcm91cCBmcm9tICcuL2NvbXBvbmVudHMvQm9va21hcmtHcm91cC5zdmVsdGUnO1xuICBpbXBvcnQgTWVudSBmcm9tICcuL2NvbXBvbmVudHMvTWVudS5zdmVsdGUnO1xuICBpbXBvcnQgU2VhcmNoIGZyb20gJy4vY29tcG9uZW50cy9TZWFyY2guc3ZlbHRlJztcblxuICB3aW5kb3cuYWRkRXZlbnRMaXN0ZW5lcignY2xpY2snLCBoYW5kbGVMaW5rQ2xpY2ssIHRydWUpO1xuPC9zY3JpcHQ+PHN0eWx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UFLLE9BQU8sQ0FBQyxLQUFLLE9BQU8sQ0FBQyxBQUFRLElBQUksQUFBQyxDQUFDLE9BQU8sSUFBSSxDQUFDLENBQUMsQ0FBQyxVQUFVLElBQUksQ0FBQyxZQUFZLElBQUksQ0FBQyxlQUFlLGFBQWEsQ0FBQyx1QkFBdUIsSUFBSSxDQUFDLE1BQU0sSUFBSSxHQUFHLENBQUMsQ0FBQyxpQkFBaUIsSUFBSSxHQUFHLENBQUMsQ0FBQyxBQUFRLE1BQU0sQUFBQyxDQUFDLEFBQVEsRUFBRSxBQUFDLENBQUMsTUFBTSxJQUFJLElBQUksQ0FBQyxDQUFDLEFBQVEsQ0FBQyxBQUFDLENBQUMsZ0JBQWdCLElBQUksQ0FBQyxBQUFRLENBQUMsQUFBQyxNQUFNLENBQUMsQUFBUSxDQUFDLEFBQUMsTUFBTSxDQUFDLGdCQUFnQixTQUFTLENBQUMifQ== */
Error: Unexpected token (Note that you need plugins to import files that are not JavaScript)
    at error (/media/max/xps-linux/home/max/Projects/new-tab/node_modules/rollup/dist/rollup.js:3410:30)
    at Module.error (/media/max/xps-linux/home/max/Projects/new-tab/node_modules/rollup/dist/rollup.js:12900:9)
    at tryParse (/media/max/xps-linux/home/max/Projects/new-tab/node_modules/rollup/dist/rollup.js:12817:16)
    at Module.setSource (/media/max/xps-linux/home/max/Projects/new-tab/node_modules/rollup/dist/rollup.js:13089:35)
    at /media/max/xps-linux/home/max/Projects/new-tab/node_modules/rollup/dist/rollup.js:15906:20
    at async Promise.all (index 5)
    at async Promise.all (index 0)
    at async Promise.all (index 0)
    at async Promise.all (index 0)
    at async Promise.all (index 0)

error Command failed with exit code 1.
@Conduitry
Copy link
Contributor

I found the original Sapper example to be a much less intimidating repro. I've been digging into it, and I'm at the point now where I have no idea how this used to work with 1.11. I've commented here in case this is helpful to someone. I'm not sure what I'm missing.

@mrkishi
Copy link

mrkishi commented May 16, 2019

The regression seems to happen because of a breaking change in this line:

f4105d4#diff-000123d2bbebc4e4c72a084a87915a34R79

Sapper deals with css by creating its own css chunks, adding a transform that captures the content and returning an empty string to rollup:

https://github.com/sveltejs/sapper/blob/ab939b8cb5867ed007d241bd6815cb04c46da796/src/core/create_compilers/RollupCompiler.ts#L37-L42

Both changing the rollup comparison or returning a space from sapper's transform fixes the bundling issue.

@Conduitry
Copy link
Contributor

Good hunting @mrkishi - Yeah that sounds definitely plausible. That also explains why I couldn't find anything in rollup-plugin-svelte - because it's handled in Sapper itself.

I agree that returning an empty string from a transformer shouldn't mean the same thing as returning null.

@lukastaegert
Copy link
Member

Thanks so much everyone here for creating reproductions and digging into this! I will look into why I made the change and try to fix it as soon as possible.

@lukastaegert
Copy link
Member

(possibly I tried to capture some null + undefined + false but forgot about empty string... 😜)

@lukastaegert
Copy link
Member

Potential fix at #2861

@maxmilton
Copy link
Author

Amazing! Thanks all 💯

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

Successfully merging a pull request may close this issue.

4 participants