sveltejs / sapper-template

Starter template for Sapper apps
703 stars 214 forks source link

Bug: Rollup plugin-replace: preventAssignment set to "false" #302

Closed Christian-Rau closed 3 years ago

Christian-Rau commented 3 years ago

So today I got this notification, and not sure what to do about it, as I don't see any preventAssignment anywhere. • service worker @rollup/plugin-replace: 'preventAssignment' currently defaults to false. It is recommended to set this option totrue, as the next major version will default this option to true. • server @rollup/plugin-replace: 'preventAssignment' currently defaults to false. It is recommended to set this option to true, as the next major version will default this option to true. • client @rollup/plugin-replace: 'preventAssignment' currently defaults to false. It is recommended to set this option to true, as the next major version will default this option to true. • service worker @rollup/plugin-replace: 'preventAssignment' currently defaults to false. It is recommended to set this option to true, as the next major version will default this option to true. `

exodus4d commented 3 years ago

Ref: https://github.com/rollup/plugins/commit/659ed596b256803e14b5bb8c5a2bceb609607696 Doku: https://github.com/rollup/plugins/tree/master/packages/replace#preventassignment

Conduitry commented 3 years ago

Transferring this to the sapper-template repo. It probably makes sense to make the @rollup/plugin-replace dependency be ^2.4.0 and add this option in rollup.config.js.

didiermun commented 3 years ago

i have the same error and don't know why it is rising. Waiting for solution

antony commented 3 years ago

@didiermunezero the solution is posted directly above your comment. Add preventAssignment: true to your rollup config.

It's also not an error, it's a warning, and does not stop you continuing unimpeded

Christian-Rau commented 3 years ago

I might add: I had trouble running npm, so i rolled back to earlier version. But will apply when upgrading. Cheers

Hent Outlook til Androidhttps://aka.ms/ghei36


From: Antony Jones notifications@github.com Sent: Friday, February 26, 2021 10:41:47 AM To: sveltejs/sapper-template sapper-template@noreply.github.com Cc: Christian Rau rauchristian@hotmail.com; Author author@noreply.github.com Subject: Re: [sveltejs/sapper-template] Bug: Rollup plugin-replace: preventAssignment set to "false" (#302)

@didiermunezerohttps://github.com/didiermunezero the solution is posted directly above your comment. Add preventAssignment: true to your rollup config.

It's also not an error, it's a warning, and does not stop you continuing unimpeded

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/sveltejs/sapper-template/issues/302#issuecomment-786531846, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ALVI6FXYQGUJGYTOIR4L3ODTA5UFXANCNFSM4YCT5NLQ.

didiermun commented 3 years ago

@didiermunezero the solution is posted directly above your comment. Add preventAssignment: true to your rollup config.

It's also not an error, it's a warning, and does not stop you continuing unimpeded

Yeah now it works, thank you. But why not make it true by default as you know that it will give a warning??

antony commented 3 years ago

That's quite literally what the warning is telling you, that it will become the default in the next release.

But I'm not sure why you're commenting here - we aren't the authors of rollup-plugin-replace and as such have no part in the decision process.

didiermun commented 3 years ago

oh that is cool and thanks! @antony

guther commented 3 years ago

You need to insert preventAssignment: true, in all instances of replace, like this:

plugins: [
    replace({
        preventAssignment: true,
        'process.browser': true,
        'process.env.NODE_ENV': JSON.stringify(mode)
    }),
Christian-Rau commented 3 years ago

Closed since it's not a bug, and the sapper template, has been updated.

shijiezhou1 commented 3 years ago

You need to insert preventAssignment: true, in all instances of replace, like this:

plugins: [
  replace({
      preventAssignment: true,
      'process.browser': true,
      'process.env.NODE_ENV': JSON.stringify(mode)
  }),

Insert and still getting the same warning