With node target, Bluebird promise doesn't work because webpack uses package.json browser field instead of main field
See original GitHub issueI’m submitting a bug report
Webpack version: 2.x
Please tell us about your environment: OSX 10.x
Current behavior:
With node target, Bluebird promise doesn’t work because webpack uses package.json browser field instead of main field.
- Create entry.js that uses bluebird and promisifyAll -
var Promise = require("bluebird");
var fs = Promise.promisifyAll(require("fs"))
- Run webpack with
output.target = 'node'
andoutput.pathinfo = true
- Open up
bundle.js
and search forbluebird.js
EXPECTING:
Since I set the target as node
, Webpack should have included ~/bluebird/js/release/bluebird.js
.
ACTUAL:
Webpack incorrectly included ~/bluebird/js/browser/bluebird.js
.
If you look at https://github.com/petkaantonov/bluebird/blob/master/package.json there is a browser and a main field.
In addition, if you run node bundle.js
you’ll get the following exception -
makeNodePromisified(key, THIS, key, fn, suffix, multiArgs); ^
TypeError: makeNodePromisified is not a function at promisifyAll (…) at Function.e.24.module.exports.Promise.promisifyAll (…)
Issue Analytics
- State:
- Created 7 years ago
- Reactions:2
- Comments:5 (2 by maintainers)
It appears that
target: 'electron-main'
suffers the same issue and included the browser version not the node version.I have the same problem and I have target=‘node’ (in the config file not CLI though). @TheLarkInn I don’t see the update to this response.