mirror of
https://github.com/maplibre/maplibre-rs.git
synced 2025-12-08 19:05:57 +00:00
63 lines
1.6 KiB
JavaScript
63 lines
1.6 KiB
JavaScript
const path = require("path");
|
|
const webpack = require("webpack");
|
|
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
|
const CopyPlugin = require("copy-webpack-plugin");
|
|
|
|
let dist = path.join(__dirname, 'dist/');
|
|
module.exports = (env) => ({
|
|
mode: "development",
|
|
entry: {
|
|
main: "./index.ts",
|
|
},
|
|
experiments: {
|
|
//syncWebAssembly: true
|
|
},
|
|
performance: {
|
|
maxEntrypointSize: 400000,
|
|
maxAssetSize: 400000000,
|
|
},
|
|
output: {
|
|
path: dist,
|
|
filename: "[name].[fullhash].js"
|
|
},
|
|
devServer: {
|
|
server: {
|
|
type: 'http',
|
|
},
|
|
allowedHosts: 'all',
|
|
host: '0.0.0.0',
|
|
static: {
|
|
directory: dist,
|
|
},
|
|
headers: {
|
|
'Cross-Origin-Opener-Policy': 'same-origin',
|
|
'Cross-Origin-Embedder-Policy': 'require-corp'
|
|
},
|
|
},
|
|
module: {
|
|
rules: [
|
|
{
|
|
test: /\.tsx?$/,
|
|
use: 'ts-loader',
|
|
exclude: /node_modules/,
|
|
},
|
|
],
|
|
},
|
|
resolve: {
|
|
extensions: ['.tsx', '.ts', '.js'],
|
|
},
|
|
plugins: [
|
|
new CopyPlugin({
|
|
patterns: [
|
|
{ from: "*.wasm", to: "[path][name][ext]", context: 'node_modules/maplibre_rs/dist/maplibre-rs/' },
|
|
{ from: "*.maplibre-rs.js", to: "[path][name][ext]", context: 'node_modules/maplibre_rs/dist/maplibre-rs/' },
|
|
],
|
|
}),
|
|
new webpack.DefinePlugin({
|
|
WEBGL: !!env.webgl
|
|
}),
|
|
new HtmlWebpackPlugin({
|
|
title: 'maplibre demo',
|
|
}),
|
|
]
|
|
}); |