Download webpack.config.js from Songyou/LLM-front: direct link, hf CLI and curl.
- Browser
- Download file 1.69 kB
-
https://huggingface.co/spaces/Songyou/LLM-front/resolve/main/webpack.config.js
- Command line
-
hf download hf://spaces/Songyou/LLM-front/webpack.config.js
-
curl -L -o webpack.config.js https://huggingface.co/spaces/Songyou/LLM-front/resolve/main/webpack.config.js
1.69 kB
| const path = require('path'); | |
| const webpack = require('webpack'); | |
| module.exports = { | |
| mode: 'development', // 或 'production' | |
| entry: './src/index.js', // 入口文件 | |
| output: { | |
| path: path.resolve(__dirname, 'dist'), // 输出目录 | |
| filename: 'bundle.js', | |
| library: 'KetcherBundle', | |
| libraryTarget: 'umd', | |
| globalObject: 'this', | |
| }, | |
| module: { | |
| rules: [ | |
| { | |
| test: /\.js$/, // 处理所有 .js 文件 | |
| exclude: /node_modules/, // 排除 node_modules 目录 | |
| use: { | |
| loader: 'babel-loader', | |
| options: { | |
| presets: ['@babel/preset-env'], // 使用 env 预设 | |
| plugins: ['@babel/plugin-transform-runtime'], // 使用 transform-runtime 插件 | |
| }, | |
| }, | |
| }, | |
| { | |
| test: /\.wasm$/, // 处理 .wasm 文件 | |
| type: 'javascript/auto', // 需要设置为 'javascript/auto' 以正确加载 WASM 文件 | |
| loader: 'file-loader', | |
| options: { | |
| name: '[name].[hash].wasm', | |
| outputPath: 'binaryWasm/', // 输出到 binaryWasm/ 目录 | |
| }, | |
| }, | |
| ], | |
| }, | |
| resolve: { | |
| fallback: { | |
| path: require.resolve('path-browserify'), // Polyfill for 'path' module | |
| buffer: require.resolve('buffer/'), // Polyfill for 'buffer' module | |
| process: require.resolve('process/browser'), // Polyfill for 'process' module | |
| fs: false, // 不提供 'fs' 模块的 polyfill | |
| }, | |
| }, | |
| plugins: [ | |
| new webpack.ProvidePlugin({ | |
| Buffer: ['buffer', 'Buffer'], // 自动提供 Buffer | |
| process: 'process/browser', // 自动提供 process | |
| }), | |
| ], | |
| experiments: { | |
| asyncWebAssembly: true, // 启用异步 WASM | |
| }, | |
| }; | |