代码拉取完成,页面将自动刷新
/** @format */
const _path = require("path")
const webpack = require("webpack")
const config = {
entry: "./src/index",
mode: "production",
resolve: {
modules: [_path.resolve(__dirname, "./src"), "node_modules"],
extensions: [".js", ".jsx", ".ts", ".tsx"],
},
module: {
rules: [
{
test: /\.s?css$/i,
use: ["style-loader", "css-loader", "sass-loader"],
},
{
test: /\.ts?$/,
exclude: /(node_modules|bower_components)/,
use: {
loader: "babel-loader",
options: {
presets: ["@babel/preset-env", "@babel/preset-typescript"],
plugins: [
"@babel/plugin-proposal-object-rest-spread",
"@babel/plugin-proposal-class-properties",
"@babel/plugin-proposal-optional-chaining",
"@babel/plugin-transform-runtime"
],
},
},
},
{
test: /\.worker\.(c|m)?js$/i,
loader: "worker-loader",
options: { inline: "fallback" },
},
],
},
}
const configWeb = {
...config,
target: "web",
output: {
path: _path.resolve(__dirname, "lib"),
filename: "index.js",
libraryTarget: "umd",
},
}
const configNode = {
...config,
target: "node",
output: {
path: _path.resolve(__dirname, "lib"),
filename: "index.node.js",
libraryTarget: "umd",
},
}
module.exports = [configWeb, configNode]
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。