balthazar / butternut-webpack-plugin Goto Github PK
View Code? Open in Web Editor NEW:nut_and_bolt: A butternut plugin for webpack
:nut_and_bolt: A butternut plugin for webpack
In our big webpack build we have this error, sadly due to copyright i cannot give you our source code, i could send you the webpack config if it helps.
The final argument to magicString.overwrite(...) should be an options object. See https://github.com/rich-harris/magic-string
/Users/ronald/Development/withlocals/node_modules/butternut/src/program/types/IfStatement.js:41
return this.alternate.getLeftHandSide();
^
TypeError: Cannot read property 'getLeftHandSide' of null
at Node.getLeftHandSide (/Users/ronald/Development/withlocals/node_modules/butternut/src/program/types/IfStatement.js:41:24)
at Node.getLeftHandSide (/Users/ronald/Development/withlocals/node_modules/butternut/src/program/BlockStatement.js:101:24)
at Node.prepend (/Users/ronald/Development/withlocals/node_modules/butternut/src/program/Node.js:136:27)
at Node.parenthesize (/Users/ronald/Development/withlocals/node_modules/butternut/src/program/Node.js:131:8)
at Node.rewriteAsTernaryExpression (/Users/ronald/Development/withlocals/node_modules/butternut/src/program/types/IfStatement.js:325:55)
at Node.minify (/Users/ronald/Development/withlocals/node_modules/butternut/src/program/types/IfStatement.js:236:10)
at Node.minify (/Users/ronald/Development/withlocals/node_modules/butternut/src/program/BlockStatement.js:226:15)
at Node.minify (/Users/ronald/Development/withlocals/node_modules/butternut/src/program/types/shared/FunctionNode.js:108:13)
at Node.minify (/Users/ronald/Development/withlocals/node_modules/butternut/src/program/types/ObjectExpression.js:20:13)
at Node.minify (/Users/ronald/Development/withlocals/node_modules/butternut/src/program/Node.js:121:32)
at Node.minify (/Users/ronald/Development/withlocals/node_modules/butternut/src/program/types/CallExpression.js:132:15)
at Node.minify (/Users/ronald/Development/withlocals/node_modules/butternut/src/program/Node.js:124:12)
at Node.minify (/Users/ronald/Development/withlocals/node_modules/butternut/src/program/types/AssignmentExpression.js:56:15)
at Node.minify (/Users/ronald/Development/withlocals/node_modules/butternut/src/program/types/VariableDeclaration.js:80:21)
at Node.minify (/Users/ronald/Development/withlocals/node_modules/butternut/src/program/BlockStatement.js:226:15)
at Node.minify (/Users/ronald/Development/withlocals/node_modules/butternut/src/program/types/shared/FunctionNode.js:108:13)
at Node.minify (/Users/ronald/Development/withlocals/node_modules/butternut/src/program/types/ParenthesizedExpression.js:100:14)
at Node.minify (/Users/ronald/Development/withlocals/node_modules/butternut/src/program/Node.js:121:32)
at Node.minify (/Users/ronald/Development/withlocals/node_modules/butternut/src/program/types/shared/Array.js:46:15)
at Node.minify (/Users/ronald/Development/withlocals/node_modules/butternut/src/program/Node.js:121:32)
at Node.minify (/Users/ronald/Development/withlocals/node_modules/butternut/src/program/types/CallExpression.js:132:15)
at Node.minify (/Users/ronald/Development/withlocals/node_modules/butternut/src/program/Node.js:124:12)
at Node.minify (/Users/ronald/Development/withlocals/node_modules/butternut/src/program/BlockStatement.js:226:15)
at Program (/Users/ronald/Development/withlocals/node_modules/butternut/src/program/Program.js:59:12)
at squash (/Users/ronald/Development/withlocals/node_modules/butternut/src/index.js:20:9)
at Compilation.compilation.plugin (/Users/ronald/Development/withlocals/node_modules/butternut-webpack-plugin/dist/index.js:39:57)
at Compilation.applyPluginsAsyncSeries (/Users/ronald/Development/withlocals/node_modules/webpack/node_modules/tapable/lib/Tapable.js:206:13)
at self.applyPluginsAsync.err (/Users/ronald/Development/withlocals/node_modules/webpack/lib/Compilation.js:640:10)
at next (/Users/ronald/Development/withlocals/node_modules/webpack/node_modules/tapable/lib/Tapable.js:202:11)
at Compilation.<anonymous> (/Users/ronald/Development/withlocals/node_modules/extract-text-webpack-plugin/dist/index.js:272:11)
when including plugin and running webpack build with -p
switch got this error
ReferenceError: nonEntryChunkPreamble is not defined
I'm getting the following error:
/node_modules/butternut/dist/butternut.cjs.js:4111
throw err;
^
SyntaxError: 'with' in strict mode (53548:0)
at Parser.pp$4.raise (/node_modules/butternut/node_modules/acorn/dist/acorn.js:2549:13)
node v6.11.0
webpack 2.3.3
Update
Looks like it's related to this issue: Rich-Harris/butternut#138
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.
TypeError: ButternutWebpackPlugin is not a constructor
my code in webpack config:
const ButternutWebpackPlugin = require('butternut-webpack-plugin');
config.plugins.push(
new ButternutWebpackPlugin({}),
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
}
})
)
any suggestions?
Hello,
I tried using the plugin, but got an error saying that "chunk.isInitial is not a function"
.
I'm using:
node: 12.9.0
webpack: 4.39.2
webpack-cli: 3.3.7
My config is the same as the readme example:
const ButternutWebpackPlugin = require("butternut-webpack-plugin").default;
module.exports = {
plugins: [
new ButternutWebpackPlugin({}),
],
};
With nothing else because I take advantage of default values
I guess this is an incompatibility with webapck@4 because I also have a warning "DeprecationWarning: Tapable.plugin is deprecated. Use new API on .hooks instead"
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.