airbnb / polyglot.js

Give your JavaScript the ability to speak many languages.
http://airbnb.github.io/polyglot.js
BSD 2-Clause "Simplified" License
3.71k stars 208 forks source link

Can't resolve module 'fs' when compiling with webpack? #63

Closed EdwardDrapkin closed 8 years ago

EdwardDrapkin commented 8 years ago

When I try to use polyglot with webpack, I get this error from webpack:

ERROR in ./~/polyglot/i18n.js Module not found: Error: Can't resolve 'fs' in 'node_modules/polyglot' @ ./~/polyglot/i18n.js 9:7-20

What am I doing wrong? My code is only:

import Polyglot from 'polyglot'; const p = new Polyglot();

ljharb commented 8 years ago

fs can't possibly work in a browser, so there'd be no point browserifying/webpacking something that requires it.