Use vite instead of webpack
This commit is contained in:
		@@ -7,8 +7,9 @@
 | 
			
		||||
    "create-wasm-app": ".bin/create-wasm-app.js"
 | 
			
		||||
  },
 | 
			
		||||
  "scripts": {
 | 
			
		||||
    "build": "webpack --config webpack.config.js",
 | 
			
		||||
    "start": "webpack-dev-server"
 | 
			
		||||
    "dev": "vite",
 | 
			
		||||
    "build": "vite build",
 | 
			
		||||
    "start": "vite preview"
 | 
			
		||||
  },
 | 
			
		||||
  "repository": {
 | 
			
		||||
    "type": "git",
 | 
			
		||||
@@ -30,9 +31,9 @@
 | 
			
		||||
    "wasm-game-of-life": "file:../pkg"
 | 
			
		||||
  },
 | 
			
		||||
  "devDependencies": {
 | 
			
		||||
    "copy-webpack-plugin": "^12.0.2",
 | 
			
		||||
    "webpack": "^5.98.0",
 | 
			
		||||
    "webpack-cli": "^6.0.1",
 | 
			
		||||
    "webpack-dev-server": "^5.2.0"
 | 
			
		||||
    "vite": "^6.1.1",
 | 
			
		||||
    "vite-plugin-static-copy": "^2.2.0",
 | 
			
		||||
    "vite-plugin-top-level-await": "^1.5.0",
 | 
			
		||||
    "vite-plugin-wasm": "^3.4.1"
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										2949
									
								
								www/pnpm-lock.yaml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										2949
									
								
								www/pnpm-lock.yaml
									
									
									
										generated
									
									
									
								
							
										
											
												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
 | 
			
		||||
	}
 | 
			
		||||
};
 | 
			
		||||
		Reference in New Issue
	
	Block a user