Changeset View
Changeset View
Standalone View
Standalone View
web/webpack.config.cjs
const AssetsPlugin = require('assets-webpack-plugin'); | const AssetsPlugin = require('assets-webpack-plugin'); | ||||
const CopyPlugin = require('copy-webpack-plugin'); | const CopyPlugin = require('copy-webpack-plugin'); | ||||
const path = require('path'); | const path = require('path'); | ||||
const { | const { | ||||
createProdBrowserConfig, | createProdBrowserConfig, | ||||
createDevBrowserConfig, | createDevBrowserConfig, | ||||
createNodeServerRenderingConfig, | createNodeServerRenderingConfig, | ||||
createWebWorkersConfig, | createWebWorkersConfig, | ||||
} = require('lib/webpack/shared.cjs'); | } = require('lib/webpack/shared.cjs'); | ||||
const babelConfig = require('./babel.config.cjs'); | const babelConfig = require('./babel.config.cjs'); | ||||
const baseBrowserConfig = { | const baseBrowserConfig = { | ||||
plugins: [ | |||||
new CopyPlugin({ | |||||
patterns: [ | |||||
{ | |||||
from: 'node_modules/@matrix-org/olm/olm.wasm', | |||||
to: path.join(__dirname, 'dist'), | |||||
}, | |||||
], | |||||
}), | |||||
], | |||||
entry: { | entry: { | ||||
browser: ['./script.js'], | browser: ['./script.js'], | ||||
}, | }, | ||||
output: { | output: { | ||||
filename: 'prod.[contenthash:12].build.js', | filename: 'prod.[contenthash:12].build.js', | ||||
path: path.join(__dirname, 'dist'), | path: path.join(__dirname, 'dist'), | ||||
}, | }, | ||||
resolve: { | resolve: { | ||||
Show All 20 Lines | devServer: { | ||||
port: 8080, | port: 8080, | ||||
headers: { 'Access-Control-Allow-Origin': '*' }, | headers: { 'Access-Control-Allow-Origin': '*' }, | ||||
allowedHosts: ['all'], | allowedHosts: ['all'], | ||||
host: '0.0.0.0', | host: '0.0.0.0', | ||||
static: { | static: { | ||||
directory: path.join(__dirname, 'dist'), | directory: path.join(__dirname, 'dist'), | ||||
}, | }, | ||||
}, | }, | ||||
plugins: [ | |||||
new CopyPlugin({ | |||||
patterns: [ | |||||
{ | |||||
from: 'node_modules/@matrix-org/olm/olm.wasm', | |||||
to: path.join(__dirname, 'dist'), | |||||
}, | |||||
], | |||||
}), | |||||
], | |||||
}; | }; | ||||
const baseProdBrowserConfig = { | const baseProdBrowserConfig = { | ||||
...baseBrowserConfig, | ...baseBrowserConfig, | ||||
plugins: [ | plugins: [ | ||||
...baseBrowserConfig.plugins, | new CopyPlugin({ | ||||
patterns: [ | |||||
{ | |||||
from: 'node_modules/@matrix-org/olm/olm.wasm', | |||||
to: path.join(__dirname, 'dist', 'olm.[contenthash:12].wasm'), | |||||
}, | |||||
], | |||||
}), | |||||
new AssetsPlugin({ | new AssetsPlugin({ | ||||
filename: 'assets.json', | filename: 'assets.json', | ||||
path: path.join(__dirname, 'dist'), | path: path.join(__dirname, 'dist'), | ||||
removeFullPathAutoPrefix: true, | removeFullPathAutoPrefix: true, | ||||
}), | }), | ||||
], | ], | ||||
}; | }; | ||||
▲ Show 20 Lines • Show All 52 Lines • Show Last 20 Lines |