Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

fix: configure webpack to not use esmodules in dependencies #1364

Merged
merged 1 commit into from
May 28, 2018

Conversation

alanshaw
Copy link
Member

@alanshaw alanshaw commented May 24, 2018

Big.js just released an update that added esmodule support by adding a "module" field to their package.json. By default, webpack will use this field when requiring a module. Since esmodules aren't fully supported in the browser and we don't do any transpiling this PR configures webpack to not consider the esmodule field.

Webpack mainFields docs

Why require('big.js') is broken for us

Fixes #1363

Note that this solves the issue for big.js, but also for any other modules in the future that decide to define a module field in their package.json or any that already do and we just haven't realised it yet!

Big.js just released an update that added esmodule support by adding a "module" field to their package.json. By default, webpack will use this field when requiring a module. Since esmodules aren't fully supported in the browser and we don't do any transpiling this PR configures webpack to not consider the esmodule field.

[Webpack `mainFields` docs](https://webpack.js.org/configuration/resolve/#resolve-mainfields)

[Why `require('big.js')` is broken for us](webpack/webpack#4742)

Fixes #1363

License: MIT
Signed-off-by: Alan Shaw <alan@tableflip.io>
@ghost ghost assigned alanshaw May 24, 2018
@ghost ghost added the status/in-progress In progress label May 24, 2018
@alanshaw alanshaw requested a review from daviddias May 24, 2018 08:57
Copy link
Contributor

@fsdiogo fsdiogo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Copy link
Member

@daviddias daviddias left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👌🏽

@daviddias daviddias merged commit 4486acc into master May 28, 2018
@ghost ghost removed the status/in-progress In progress label May 28, 2018
@daviddias daviddias deleted the fix/big-is-not-a-fun branch May 28, 2018 04:49
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Big is not a function error
3 participants