Use vite instead of webpack
This commit is contained in:
parent
922a7d3160
commit
451263fcb4
@ -7,8 +7,9 @@
|
|||||||
"create-wasm-app": ".bin/create-wasm-app.js"
|
"create-wasm-app": ".bin/create-wasm-app.js"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "webpack --config webpack.config.js",
|
"dev": "vite",
|
||||||
"start": "webpack-dev-server"
|
"build": "vite build",
|
||||||
|
"start": "vite preview"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
@ -30,9 +31,9 @@
|
|||||||
"wasm-game-of-life": "file:../pkg"
|
"wasm-game-of-life": "file:../pkg"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"copy-webpack-plugin": "^12.0.2",
|
"vite": "^6.1.1",
|
||||||
"webpack": "^5.98.0",
|
"vite-plugin-static-copy": "^2.2.0",
|
||||||
"webpack-cli": "^6.0.1",
|
"vite-plugin-top-level-await": "^1.5.0",
|
||||||
"webpack-dev-server": "^5.2.0"
|
"vite-plugin-wasm": "^3.4.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
2949
www/pnpm-lock.yaml
2949
www/pnpm-lock.yaml
File diff suppressed because it is too large
Load Diff
31
www/vite.config.mjs
Normal file
31
www/vite.config.mjs
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
import { defineConfig } from 'vite';
|
||||||
|
import { viteStaticCopy } from 'vite-plugin-static-copy';
|
||||||
|
import wasm from 'vite-plugin-wasm';
|
||||||
|
import topLevelAwait from 'vite-plugin-top-level-await';
|
||||||
|
|
||||||
|
export default defineConfig({
|
||||||
|
build: {
|
||||||
|
target: 'esnext',
|
||||||
|
outDir: 'dist',
|
||||||
|
rollupOptions: {
|
||||||
|
input: './bootstrap.js',
|
||||||
|
output: {
|
||||||
|
entryFileNames: 'bootstrap.js',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
plugins: [
|
||||||
|
viteStaticCopy({
|
||||||
|
targets: [
|
||||||
|
{
|
||||||
|
src: 'index.html',
|
||||||
|
dest: '',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
}),
|
||||||
|
wasm(),
|
||||||
|
topLevelAwait()
|
||||||
|
],
|
||||||
|
mode: 'development',
|
||||||
|
});
|
||||||
|
|
@ -1,19 +0,0 @@
|
|||||||
const CopyWebpackPlugin = require("copy-webpack-plugin");
|
|
||||||
const path = require('path');
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
entry: "./bootstrap.js",
|
|
||||||
output: {
|
|
||||||
path: path.resolve(__dirname, "dist"),
|
|
||||||
filename: "bootstrap.js",
|
|
||||||
},
|
|
||||||
mode: "development",
|
|
||||||
plugins: [
|
|
||||||
new CopyWebpackPlugin({
|
|
||||||
patterns: ['index.html']
|
|
||||||
})
|
|
||||||
],
|
|
||||||
experiments: {
|
|
||||||
asyncWebAssembly: true
|
|
||||||
}
|
|
||||||
};
|
|
Loading…
Reference in New Issue
Block a user