butternut-webpack-plugin icon indicating copy to clipboard operation
butternut-webpack-plugin copied to clipboard

Cannot read property minify of null

Open estrattonbailey opened this issue 7 years ago • 11 comments

Hey! Thanks for the lib.

I might be totally missing something, but when I installed from npm all I got was the README.md and the package.json. It could be because npm inherits the .gitignore config if it's available, so a blank .npmignore should override it, in my experience.

Happy to make a PR, but figured that you'd want to determine what else npm ignores and it's tiny tiny change 😛


UPDATE: I had manually compiled this lib locally and ran into errors, a la:

NODE_ENV=production webpack --config webpack.production.config.js -p

/Users/eric.bailey/Sites/quanta-server/node_modules/butternut-webpack-plugin/node_modules/butternut/dist/butternut.cjs.js:1662
				this.alternate.minify( code );

I just needed to remov the -p flag from the webpack command. My bad! Updating here in case it helps someone else.

estrattonbailey avatar May 16 '17 22:05 estrattonbailey

Arrrrgh totally my bad, can you install the 0.0.6 version?

balthazar avatar May 16 '17 23:05 balthazar

Sweet, thanks!

estrattonbailey avatar May 17 '17 00:05 estrattonbailey

The same error is happening here and I'm using version 0.0.6 😢

pedronauck avatar May 30 '17 20:05 pedronauck

Hey pedronauck! Don't cry! :smile: Can you check the content of the package installed? The version in the module package.json is 0.0.6? Checking the unpkg returns me the correct index.js

balthazar avatar May 30 '17 20:05 balthazar

Yes, it's the same file, and that's the error

/Users/pedronauck/Projects/personal/projects/shazam/node_modules/butternut/dist/butternut.cjs.js:1662
				this.alternate.minify( code );
				              ^

TypeError: Cannot read property 'minify' of null

I'm using Webpack 2!

pedronauck avatar May 31 '17 16:05 pedronauck

I think this is an issue with butternut itself rather than the module then, a similar issue has been reported in #123, as @estrattonbailey said, you need to remove the -p option.

balthazar avatar May 31 '17 16:05 balthazar

Hi. I had the same error:

Cannot read property 'minify' of null

The option that cause it is:

'process.env.NODE_ENV': JSON.stringify('production')

gombek avatar Jun 01 '17 07:06 gombek

Yup, agree with @gombek. It's breaking when NODE_ENV is "production". If I just change what the DefinePlugin's value for process.env.NODE_ENV equals, it doesn't break anything, but if NODE_ENV is actually set to "production", this error shows up.

Note: I'm currently minifying for both dev and prod, so it's not a simple mistake of not running Butternut in dev.

joezimjs avatar Jun 01 '17 15:06 joezimjs

Reopening for visibility, it's quite annoying that setting the production env does this, since butternut is intended to be run only with this one

balthazar avatar Jun 01 '17 16:06 balthazar

Hmm, just run into this, but it looks like relevant issue https://github.com/Rich-Harris/butternut/issues/137 might be already fixed on master, but this plugin depends on "butternut": "^0.3.5" so versions 0.4.* (including latest 0.4.6) are not installed.

@Apercu Could you bump the dependency or maybe even make it peerDependency and let people install preferred version of babili on their own?

RReverser avatar Jun 23 '17 23:06 RReverser

Bumped all deps in 0.1.0, let me know.

balthazar avatar Jun 23 '17 23:06 balthazar