mirror of
https://github.com/maplibre/maplibre-rs.git
synced 2025-12-08 19:05:57 +00:00
68 lines
2.0 KiB
JavaScript
68 lines
2.0 KiB
JavaScript
const path = require("path");
|
|
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
|
//const CopyPlugin = require("copy-webpack-plugin");
|
|
const webpack = require("webpack");
|
|
|
|
let dist = path.join(__dirname, 'dist/');
|
|
module.exports = (env) => ({
|
|
mode: "development",
|
|
entry: {
|
|
main: "./index.ts",
|
|
},
|
|
experiments: {
|
|
asyncWebAssembly: env.cjs ? false : 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: /\.ts$/,
|
|
use: 'ts-loader',
|
|
exclude: /node_modules/,
|
|
},
|
|
],
|
|
},
|
|
resolve: {
|
|
extensions: ['.ts', '.js'],
|
|
//mainFields: env.cjs ? ['main', 'module'] : undefined,
|
|
},
|
|
plugins: [
|
|
new webpack.DefinePlugin({
|
|
'process.env.CJS': !!env.cjs
|
|
}),
|
|
/*new CopyPlugin({
|
|
patterns: [
|
|
// webpack
|
|
//{ 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/' },
|
|
// parcel
|
|
{from: "*.wasm", to: "[path]maplibre[ext]", context: 'node_modules/maplibre_rs/dist/parcel-cjs/'},
|
|
{from: "*worker*", to: "[path]worker[ext]", context: 'node_modules/maplibre_rs/dist/parcel-cjs/'},
|
|
],
|
|
}),*/
|
|
new HtmlWebpackPlugin({
|
|
title: 'maplibre demo',
|
|
}),
|
|
]
|
|
}); |