让延迟加载文件(*.ts)被编译的正确方法是什么
What is the right way to let the lazyloaded file (*.ts) to be compiled
当 lazyLoading 通过 oclazyloader 为 angularjs 编写脚本文件时,例如:
$stateProvider
.state('tokenReceived', {
url: '/somurl',
//templateUrl: '/views/index.html',
controller: "controllers.loremCtrl",
resolve: {
deps: ['$ocLazyLoad', function ($ocLazyLoad) {
return $ocLazyLoad.load({
files: [
scriptPath + 'loremCtrl.js'
],
cache:false
});
}]
}
})
andy 我的 tsconfig.json 文件看起来像
{
"compilerOptions": {
"module": "commonjs",
"typeRoots": [
"./node_modules/@types/"
],
"noImplicitAny": false,
"noEmitOnError": true,
"removeComments": false,
"sourceMap": true,
"target": "es5"
},
"exclude": [
"node_modules",
"wwwroot"
]
}
webpack里面定义的entry是这样的
module.exports = function (env) {
return Merge(require(`./webpack.${env}.js`), {
entry: {
vendor: [
"jquery",
"toastr"
],
rootApp: "./Scripts/rootApp.js",
},
resolve: {
extensions: [".ts", "tsx", ".js"]
},
module: {
rules: [
//NON-PRE
{ test: /\.ts?$/, loader: "ts-loader" },
{ test: /\.css$/, use: ExtractTextPlugin.extract({ use: ['css-loader'] }) },
//PRE
{ test: /(\.png|\.gif|\.ttf|\.eot|\.woff|\.svg)/, loader: "file-loader", enforce: "pre", },
{ test: /\.js$/, loader: "source-map-loader", enforce: "pre", }
]
},
}
}
让延迟加载的文件(*.ts)被webpack2编译的正确方法是什么?
起初我在 tsconfig.json compileOnSave: true 但是这个不需要和 webpack 结合使用?我错过了什么吗?
"loremCtrl.ts"是在"rootApp.js"中编译保存的吗?我应该如何使用webpack来编译lazyloaded文件?
这似乎只是在开发中结合 webpack-dev-server 更新延迟加载代码
当 lazyLoading 通过 oclazyloader 为 angularjs 编写脚本文件时,例如:
$stateProvider
.state('tokenReceived', {
url: '/somurl',
//templateUrl: '/views/index.html',
controller: "controllers.loremCtrl",
resolve: {
deps: ['$ocLazyLoad', function ($ocLazyLoad) {
return $ocLazyLoad.load({
files: [
scriptPath + 'loremCtrl.js'
],
cache:false
});
}]
}
})
andy 我的 tsconfig.json 文件看起来像
{
"compilerOptions": {
"module": "commonjs",
"typeRoots": [
"./node_modules/@types/"
],
"noImplicitAny": false,
"noEmitOnError": true,
"removeComments": false,
"sourceMap": true,
"target": "es5"
},
"exclude": [
"node_modules",
"wwwroot"
]
}
webpack里面定义的entry是这样的
module.exports = function (env) {
return Merge(require(`./webpack.${env}.js`), {
entry: {
vendor: [
"jquery",
"toastr"
],
rootApp: "./Scripts/rootApp.js",
},
resolve: {
extensions: [".ts", "tsx", ".js"]
},
module: {
rules: [
//NON-PRE
{ test: /\.ts?$/, loader: "ts-loader" },
{ test: /\.css$/, use: ExtractTextPlugin.extract({ use: ['css-loader'] }) },
//PRE
{ test: /(\.png|\.gif|\.ttf|\.eot|\.woff|\.svg)/, loader: "file-loader", enforce: "pre", },
{ test: /\.js$/, loader: "source-map-loader", enforce: "pre", }
]
},
}
}
让延迟加载的文件(*.ts)被webpack2编译的正确方法是什么?
起初我在 tsconfig.json compileOnSave: true 但是这个不需要和 webpack 结合使用?我错过了什么吗?
"loremCtrl.ts"是在"rootApp.js"中编译保存的吗?我应该如何使用webpack来编译lazyloaded文件?
这似乎只是在开发中结合 webpack-dev-server 更新延迟加载代码