mjackson / mach

HTTP for JavaScript
810 stars 41 forks source link

Make compatible with Webpack #61

Closed appsforartists closed 9 years ago

appsforartists commented 9 years ago

By default, webpack will choke if you try to include mach:

ERROR in ./~/mach/modules/file.js
Module not found: Error: Cannot resolve module 'fs' in node_modules/mach/modules
 @ ./~/mach/modules/file.js 1:9-22

ERROR in ./~/mach/modules/server/ConnectionProperties.js
Module not found: Error: Cannot resolve module 'fs' in node_modules/mach/modules/server
 @ ./~/mach/modules/server/ConnectionProperties.js 1:9-22

You can presently work around it by adding the following IgnorePlugin to your webpack settings:

  new Webpack.IgnorePlugin(
    /server/,
    /mach/
  )

It should work out of the box by default, by utilizing the package.json browser field to generate a client-safe build.