Revision 43ff5d416262620cd50714a10879d9740779f474 authored by Boris Sekachev on 30 October 2023, 07:39:31 UTC, committed by GitHub on 30 October 2023, 07:39:31 UTC
1 parent fc47f58
webpack.config.js
// Copyright (C) 2020-2022 Intel Corporation
//
// SPDX-License-Identifier: MIT
/* global
__dirname:true
*/
const path = require('path');
const nodeConfig = {
target: 'node',
mode: 'development',
devtool: 'source-map',
entry: './src/api.ts',
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'cvat-core.node.js',
libraryTarget: 'commonjs',
},
resolve: {
extensions: ['.ts', '.js'],
},
module: {
rules: [
{
test: /.ts?$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {
plugins: [
'@babel/plugin-proposal-class-properties',
'@babel/plugin-proposal-optional-chaining',
],
presets: ['@babel/preset-env', '@babel/typescript'],
sourceType: 'unambiguous',
},
},
},
],
},
stats: {
warnings: false,
},
};
const webConfig = {
target: 'web',
mode: 'production',
devtool: 'source-map',
entry: {
'cvat-core': './src/api.ts',
},
output: {
path: path.resolve(__dirname, 'dist'),
filename: '[name].[contenthash].min.js',
library: 'cvat-core.js',
libraryTarget: 'window',
},
resolve: {
extensions: ['.ts', '.js'],
},
module: {
rules: [
{
test: /.ts?$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {
plugins: [
'@babel/plugin-proposal-class-properties',
'@babel/plugin-proposal-optional-chaining',
],
presets: ['@babel/preset-env', '@babel/typescript'],
sourceType: 'unambiguous',
},
},
},
{
test: /3rdparty\/.*\.worker\.js$/,
use: {
loader: 'worker-loader',
options: {
publicPath: '/static/engine/js/3rdparty/',
filename: '[name].[contenthash].js',
esModule: false,
},
},
},
{
test: /\.worker\.js$/,
exclude: /3rdparty/,
use: {
loader: 'worker-loader',
options: {
publicPath: '/static/engine/js/',
filename: '[name].[contenthash].js',
esModule: false,
},
},
},
],
},
};
module.exports = [nodeConfig, webConfig];
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...