automerge/automerge-js/examples/webpack
2022-10-06 22:53:21 +01:00
..
public example webpack for js 2022-05-22 13:53:11 -04:00
src Rename automerge and automerge-wasm packages 2022-10-04 22:05:56 +01:00
.gitignore example webpack for js 2022-05-22 13:53:11 -04:00
package.json bump @automerge/automerge-wasm and @automerge/automerge versions 2022-10-06 22:53:21 +01:00
README.md Add examples of using automerge with bundlers 2022-10-04 17:23:37 +01:00
webpack.config.js Add examples of using automerge with bundlers 2022-10-04 17:23:37 +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