非常感谢任何帮助。
以下结构在我的asp.net core 2.0应用程序中。
project
├───Controller
│ └───HomeController.cs
├───Scripts
│ ├───FolderA
│ │ ├───A1.ts
│ │ ├───A2.ts
│ │ └───A3.ts
│ ├───FolderB
│ │ │───FolderB1
│ │ │ └───B11.ts
│ │ └───FolderB2
│ │ ├───B21.ts
│ │ └───B22.ts
│ ├───FolderC
│ │ ├───C1.ts
│ │ └───C3.ts
│ └───outside.ts
├───Views
│ ├───Home
│ │ └───Index.cshtml
│ └───Shared
│ └───Layout.cshtml
└───wwwroot
│ └───Output
│ └───[Same structure like /Scripts]
├───project.csproj
├───Program.cs
├───StartUp.cs
├───package.json
├───tsconfig.json
├───webpack.config.json
Scripts文件夹中的内容是所有typescripts文件
的
1.有没有办法将所有打字稿文件传递给webpack条目
2.执行webpack后,我们可以在wwwroot / Output(.js文件)中有相同的文件夹结构,如Scripts / TypeScripts(.ts文件)
以下是我的webpack.config.json代码
var path = require('path');
var webpack = require("webpack");
module.exports = {
mode: 'development',
context: __dirname,
entry: {
**// 1. Need something like wildcard to grab everything inside this TypeScripts folder**
A1: './Scripts/TypeScripts/FolderA/A.ts',
B11: './Scripts/TypeScripts/FolderB/FolderB1/B11.ts',
B21: './Scripts/TypeScripts/FolderB/FolderB2/B21.ts',
B22: './Scripts/TypeScripts/FolderB/FolderB2/B22.ts',
C1: './Scripts/TypeScripts/FolderC/C1.ts',
outside: './Scripts/TypeScripts/outside.ts'
},
module: {
rules: [
{
test: /\.ts(x?)$/,
exclude: /node_modules/,
loader: 'babel-loader',
query: {
presets: [["env"]]
}
}
]
},
resolve: {
extensions: ['.ts', '.tsx']
},
output: {
**// 2. Need a way to keep same structure in wwwroot/Output/**
// The format for the outputted files
filename: '[name].js',
// Put the files in "wwwroot/Output/"
path: path.resolve(__dirname, 'wwwroot/Output/')
}
};