| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120 |
- const path = require('path');
- const MiniCssExtractPlugin = require('mini-css-extract-plugin');
- const ESLintPlugin = require('eslint-webpack-plugin');
- const ProgressBarWebpackPlugin = require('progress-bar-webpack-plugin');
- const resolve = (url) => path.resolve(__dirname, '..', url);
- module.exports = {
- mode: 'development',
- devtool: 'source-map',
- entry: {
- client: resolve("src/client.ts"),
- },
- module: {
- rules: [
- {
- test: /\.tsx?$/,
- use: [
- {
- loader: 'babel-loader',
- options: {
- cacheDirectory: true,
- },
- },
- {
- loader: 'ts-loader',
- },
- ],
- },
- {
- test: /\.css$/,
- use: [
- {
- loader: MiniCssExtractPlugin.loader,
- options: {
- publicPath: '../',
- },
- },
- {
- loader: 'css-loader',
- },
- ],
- },
- {
- test: /\.less$/,
- use: [
- {
- loader: MiniCssExtractPlugin.loader,
- options: {
- publicPath: '../',
- },
- },
- {
- loader: 'css-loader',
- },
- {
- loader: 'less-loader',
- },
- ],
- },
- {
- test: /\.(png|svg|jpe?g|gif)$/i,
- use: [
- {
- loader: 'url-loader',
- options: {
- limit: 18192,
- outputPath: 'img',
- name: '[name].[ext]?[hash]',
- esModule: false,
- },
- },
- ],
- },
- {
- test: /\.(woff|woff2|eot|ttf|otf)$/i,
- use: [
- {
- loader: 'file-loader',
- options: {
- outputPath: 'font',
- esModule: false,
- },
- },
- ],
- },
- {
- test: /\.wasm$/,
- type: 'webassembly/async',
- },
- ],
- },
- resolve: {
- extensions: ['.ts', '.tsx', '.js', '.json'],
- alias: {
- '@': resolve('src'),
- },
- },
- experiments: {
- syncWebAssembly: true,
- asyncWebAssembly: true,
- topLevelAwait: true,
- },
- plugins: [
- new ESLintPlugin({
- overrideConfigFile: resolve(".eslintrc.js"),
- context: resolve("src"),
- extensions: ['ts', 'js'],
- fix: true,
- }),
- new ProgressBarWebpackPlugin(),
- ],
- target: 'web',
- output: {
- filename: 'js/[name].js',
- libraryTarget: 'umd',
- library: 'Web',
- path: resolve('dist'),
- },
- };
|