inula/packages/inula-dev-tools/webpack.dev.js

78 lines
1.7 KiB
JavaScript

/*
* Copyright (c) 2023 Huawei Technologies Co.,Ltd.
*
* openInula is licensed under Mulan PSL v2.
* You can use this software according to the terms and conditions of the Mulan PSL v2.
* You may obtain a copy of Mulan PSL v2 at:
*
* http://license.coscl.org.cn/MulanPSL2
*
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
* See the Mulan PSL v2 for more details.
*/
import path from 'path';
import webpack from 'webpack';
// 用于 panel 页面开发
module.exports = {
entry: {
panel: './src/panel/index.tsx',
mockPage: './src/devtools/mockPage/index.tsx',
},
output: {
path: path.resolve(__dirname, './dist'),
filename: '[name].js',
},
mode: 'development',
devtool: 'source-map',
module: {
rules: [
{
test: /\.tsx?$/,
exclude: /node_modules/,
use: [
{
loader: 'babel-loader',
},
],
},
{
test: /\.less/i,
use: [
'style-loader',
{
loader: 'css-loader',
options: {
modules: true,
},
},
'less-loader',
],
},
],
},
resolve: {
extensions: ['.js', '.ts', 'tsx'],
},
externals: {
openinula: 'Inula',
},
plugins: [
new webpack.DefinePlugin({
'process.env.NODE_ENV': '"development"',
isDev: 'true',
}),
],
devServer: {
static: {
directory: path.join(__dirname, 'build'),
},
open: 'panel.html',
port: 9000,
magicHtml: true,
},
};