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

Deprecation warning #258

Closed
supersnager opened this issue Apr 7, 2020 · 12 comments
Closed

Deprecation warning #258

supersnager opened this issue Apr 7, 2020 · 12 comments

Comments

@supersnager
Copy link

My config:

postcss( {
        modules: false,  
        extract: true,  
        extensions: [ ".css" ],  
        minimize: true,  
        sourceMap: true  
      })

This emits deprecation warning from rollup:

(!) A plugin is directly adding properties to the bundle object in the "generateBundle" hook. This is deprecated and will be removed in a future Rollup version, please use "this.emitFile" instead.

@frederikhors
Copy link

Same here.

@himself65
Copy link
Collaborator

Relate: 1170e89 #244

@MrJohz
Copy link

MrJohz commented Apr 8, 2020

Relate: 1170e89 #244

It looks like you reverted the change that fixed this - can you explain what was wrong with that PR?

@himself65
Copy link
Collaborator

It looks like you reverted the change that fixed this - can you explain what was wrong with that PR?

#250

@MrJohz
Copy link

MrJohz commented Apr 8, 2020

Aha, thanks! To fix that, would some sort of migration path make sense? E.g:

extract: true -> use this.emitFile and avoid the deprecation warning
extract:'string' -> use the existing bundle[filename] assignment.

Alternatively, a new configuration key could be given: emit (which is just a boolean value). It would be an error to configure both emit and extract at the same time.

I think adding the new configuration key is the only way to avoid any breaking changes, but it also adds more configuration options, which is also difficult. I'm happy to put together a pull request for any of these options - which do you think makes the most sense?

@himself65
Copy link
Collaborator

I would like to use this.emitFile, but there have some incompatible as you can see. but I think we just need to resolve the path to compatible with the emitFile, it will work. BTW, I'm very welcome you to open a PR.

@gavinsharp
Copy link

Just linking this PR since it is related (outdated; possibly incomplete given issues mentioned here earlier): #197

@inno76tink
Copy link

inno76tink commented Apr 17, 2020

hey deprecate message patch

node_modules/rollup-plugin-postcss/dist/index.js

  1. line 821 change
    from code :
    generateBundle(options_, bundle) {

to code
generateBundle(options_, bundle) {
var _this = this;

  1. line 905 change
    from code :
    const codeFile = {
    fileName: codeFileName,
    isAsset: true,
    source: code
    };
    bundle[codeFile.fileName] = codeFile;

     if (map) {
       const mapFile = {
         fileName: mapFileName,
         isAsset: true,
         source: map
       };
       bundle[mapFile.fileName] = mapFile;
    

to code :
const codeFile = {
fileName: codeFileName,
type: 'asset',
source: code
};
_this.emitFile(codeFile)
if (map) {
const mapFile = {
fileName: mapFileName,
type: 'asset',
source: map
};
_this.emitFile(mapFile)

==================================================
If you do this, the deprecate message is no longer printed.

my rollup version 2.6.1

@vladshcherbin
Copy link

Please use #197 solution or other fix, this warning in watch mode looks extremely bad, it is printed on every rebuild:

image

🙏

@SASUKE40
Copy link
Collaborator

Please use #197 solution or other fix, this warning in watch mode looks extremely bad, it is printed on every rebuild:

image

🙏

The rollup v2 adaptation is still work in progress and will be released soon to resolve this warning.

@SASUKE40
Copy link
Collaborator

It is solved in v2.8.1 via upgrading rollup to v2.

@vladshcherbin
Copy link

@SASUKE40 It's gone, thank you ❤️

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

No branches or pull requests

8 participants