You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
78 lines
1.8 KiB
78 lines
1.8 KiB
const { resolve } = require("path"); |
|
const HtmlWebpackPlugin = require("html-webpack-plugin"); |
|
const FriendlyErrorsWebpackPlugin = require("friendly-errors-webpack-plugin"); |
|
const CopyPlugin = require("copy-webpack-plugin"); |
|
const webpack = require("webpack"); |
|
|
|
module.exports = { |
|
entry: "./src/index.tsx", |
|
resolve: { |
|
extensions: [".js", ".jsx", ".ts", ".tsx"], |
|
}, |
|
output: { |
|
path: resolve(__dirname, "dist"), |
|
}, |
|
module: { |
|
rules: [ |
|
{ |
|
test: /\.mjs$/, |
|
include: /node_modules/, |
|
type: "javascript/auto", |
|
resolve: { |
|
fullySpecified: false, |
|
}, |
|
}, |
|
{ |
|
test: [/\.jsx?$/, /\.tsx?$/], |
|
use: ["ts-loader"], |
|
exclude: /node_modules/, |
|
}, |
|
{ |
|
test: /\.css$/, |
|
use: ["style-loader", "css-loader"], |
|
}, |
|
{ |
|
test: /\.(scss|sass)$/, |
|
use: ["style-loader", "css-loader", "postcss-loader"], |
|
}, |
|
{ |
|
test: /\.(jpe?g|png|gif|svg)$/i, |
|
use: [ |
|
"file-loader?hash=sha512&digest=hex&name=img/[contenthash].[ext]", |
|
"image-webpack-loader?bypassOnDebug&optipng.optimizationLevel=7&gifsicle.interlaced=false", |
|
], |
|
}, |
|
{ |
|
test: /\.(woff|woff2|ttf)$/, |
|
use: { |
|
loader: "url-loader", |
|
}, |
|
}, |
|
], |
|
}, |
|
plugins: [ |
|
new CopyPlugin({ |
|
patterns: [ |
|
{ |
|
from: "node_modules/onnxruntime-web/dist/*.wasm", |
|
to: "[name][ext]", |
|
}, |
|
{ |
|
from: "model", |
|
to: "model", |
|
}, |
|
{ |
|
from: "src/assets", |
|
to: "assets", |
|
}, |
|
], |
|
}), |
|
new HtmlWebpackPlugin({ |
|
template: "./src/assets/index.html", |
|
}), |
|
new FriendlyErrorsWebpackPlugin(), |
|
new webpack.ProvidePlugin({ |
|
process: "process/browser", |
|
}), |
|
], |
|
};
|
|
|