|
@@ -1,3 +1,4 @@
|
|
|
+const tsImportPluginFactory = require("ts-import-plugin"); // 按需加载
|
|
|
const path = require("path");
|
|
|
const resolve = dir => {
|
|
|
return path.resolve(process.cwd(), dir);
|
|
@@ -18,6 +19,20 @@ module.exports = {
|
|
|
module: {
|
|
|
rules: [
|
|
|
{
|
|
|
+ test: /\.(jsx|tsx|js|ts)$/,
|
|
|
+ loader: "ts-loader",
|
|
|
+ options: {
|
|
|
+ transpileOnly: true,
|
|
|
+ getCustomTransformers: () => ({
|
|
|
+ before: [tsImportPluginFactory(/** options */)]
|
|
|
+ }),
|
|
|
+ compilerOptions: {
|
|
|
+ module: "es2015"
|
|
|
+ }
|
|
|
+ },
|
|
|
+ exclude: /node_modules/
|
|
|
+ },
|
|
|
+ /*{
|
|
|
test: /\.(j|t)sx?$/,
|
|
|
include: [resolve("src")],
|
|
|
exclude: /node_modules/,
|
|
@@ -50,7 +65,7 @@ module.exports = {
|
|
|
],
|
|
|
sourceMap: true
|
|
|
}
|
|
|
- },
|
|
|
+ },*/
|
|
|
{
|
|
|
test: /\.(png|jpe?g|gif|webp)(\?.*)?$/,
|
|
|
use: [
|