Spaces:
Runtime error
Runtime error
File size: 4,435 Bytes
b227c1f |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 |
const path = require('path');
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const CopyWebpackPlugin = require('copy-webpack-plugin');
module.exports = {
entry: {
main: './ts/main.ts',
// captioning: './ts/captioning.ts'
},
module: {
rules: [
{
test: /\.tsx?$/,
exclude: [
/node_modules/,
/ImageContentBox\.ts/,
/test\.ts/
// path.resolve(__dirname,'ts/vis/ImageContentBox.ts')
],
use: [{
loader: 'cache-loader'
},
{
loader: 'thread-loader',
options: {
// there should be 1 cpu for the fork-ts-checker-webpack-plugin
workers: require('os').cpus().length - 1,
},
},
{
loader: 'ts-loader',
options: {
happyPackMode: true // IMPORTANT! use happyPackMode mode to speed-up compilation and reduce errors reported to webpack
}
}
].slice(process.env.CI ? 2 : 0) // no optimizations for CIs
},
{
test: /\.s?css$/,
use: [
{
loader: MiniCssExtractPlugin.loader,
options: {
// you can specify a publicPath here
// by default it use publicPath in webpackOptions.output
// publicPath: '../'
}
},
{
loader: 'css-loader',
options: {
minimize: true,
sourceMap: true
}
},
{
loader: 'sass-loader',
options: {
sourceMap: true
}
}
]
},
{
test: /\.(png|jpg)$/,
loader: 'url-loader',
options: {
limit: 20000 //inline <= 10kb
}
},
{
test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/,
loader: 'url-loader',
options: {
limit: 20000, //inline <= 20kb
mimetype: 'application/font-woff'
}
},
{
test: /\.svg(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/,
loader: 'url-loader',
options: {
limit: 10000, //inline <= 10kb
mimetype: 'image/svg+xml'
}
},
{
test: /\.(ttf|eot)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
loader: 'file-loader'
}
]
},
resolve: {
extensions: ['.ts', '.js']
},
plugins: [
new MiniCssExtractPlugin({
// Options similar to the same options in webpackOptions.output
// both options are optional
// filename: "style.css",
// chunkFilename: "chunk.css"
}),
new ForkTsCheckerWebpackPlugin({
checkSyntacticErrors: true
}),
new CopyWebpackPlugin([
{from: 'img', to: 'img'},
{from: "demo", to:"demo"}
]),
],
optimization: {
splitChunks: {
cacheGroups: {
vendor: {
test: /node_modules/,
chunks: "initial",
name: "vendor",
priority: 10,
enforce: true
}
}
}
},
output: {
filename: '[name].js',
path: path.resolve(__dirname, '../dist/')
},
devServer: {
port: 8090,
proxy: {
'/api/*': {
target: 'http://localhost:8080',
secure: false,
ws: true
}
}
}
}; |