inula/packages/inula-request/webpack.useIR.config.js

65 lines
1.6 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.
*/
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const { resolve } = require('path');
module.exports = {
entry: './examples/useIR/index.jsx', // 入口文件
output: {
path: path.resolve(__dirname, 'dist'), // 输出目录
filename: 'bundle.js', // 输出文件名
},
module: {
rules: [
{
test: /\.([t|j]s)x?$/i,
use: {
loader: 'babel-loader',
options: {
presets: [
'@babel/preset-env',
[
'@babel/preset-react',
{
runtime: 'automatic',
importSource: 'openinula',
},
],
'@babel/preset-typescript',
],
},
},
},
],
},
plugins: [
new HtmlWebpackPlugin({
template: resolve(__dirname, './examples/useIR/index.html'),
}),
],
resolve: {
extensions: ['.tsx', '.jsx', '.ts', '.js', '.json'],
},
devServer: {
https: false,
host: 'localhost',
port: '8888',
open: true,
hot: true,
},
};