automerge/javascript/examples/webpack
Alex Good 8e131922e7
Move wrappers/javascript -> javascript
Continuing our theme of treating all languages equally, move
wrappers/javascript to javascrpit. Automerge libraries for new languages
should be built at this top level if possible.
2022-10-16 19:55:54 +01:00
..
public Move wrappers/javascript -> javascript 2022-10-16 19:55:54 +01:00
src Move wrappers/javascript -> javascript 2022-10-16 19:55:54 +01:00
.gitignore Move wrappers/javascript -> javascript 2022-10-16 19:55:54 +01:00
package.json Move wrappers/javascript -> javascript 2022-10-16 19:55:54 +01:00
README.md Move wrappers/javascript -> javascript 2022-10-16 19:55:54 +01:00
webpack.config.js Move wrappers/javascript -> javascript 2022-10-16 19:55:54 +01:00

Webpack + Automerge

Getting WASM working in webpack 5 is very easy. You just need to enable the asyncWebAssembly experiment. For example:

const path = require('path');

const clientConfig = {
  experiments: { asyncWebAssembly: true },
  target: 'web',
  entry: './src/index.js',
  output: {
    filename: 'main.js',
    path: path.resolve(__dirname, 'public'),
  },
  mode: "development", // or production
  performance: {       // we dont want the wasm blob to generate warnings
     hints: false,
     maxEntrypointSize: 512000,
     maxAssetSize: 512000
  }
};

module.exports = clientConfig

Running the example

yarn install
yarn start