Я начинаю использовать веб-пакет для проекта angular. Пакеты получают сгенерированный файл, но я хотел бы увидеть файл карт, чтобы иметь возможность отлаживать код TS / JS из браузера при компиляции в режиме dev.
My tsconfig. json is :
{
"compilerOptions": {
"target": "es5",
"module": "es2015",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": true,
"noImplicitAny": true,
"skipLibCheck": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"lib": [
"es2015",
"dom"
],
"typeRoots": [
"./node_modules/@types/"
]
},
"exclude": [
"node_modules",
"./angularApp/main-aot.ts"
],
"awesomeTypescriptLoaderOptions": {
"useWebpackText": true
},
"compileOnSave": false,
"buildOnSave": false
}
Мой webpack.dev. js выглядит следующим образом:
const path = require('path');
const rxPaths = require('rxjs/_esm5/path-mapping');
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const CleanWebpackPlugin = require('clean-webpack-plugin');
const FilterWarningsPlugin = require('webpack-filter-warnings-plugin');
const helpers = require('./webpack.helpers');
const ROOT = path.resolve(__dirname, '..');
console.log('@@@@@@@@@ USING DEVELOPMENT @@@@@@@@@@@@@@@');
module.exports = {
mode: 'development',
devtool: 'inline-source-map',
performance: {
hints: false
},
entry: {
polyfills: './angularApp/polyfills.ts',
vendor: './angularApp/vendor.ts',
app: './angularApp/main.ts'
},
output: {
path: ROOT + '/wwwroot/',
filename: 'dist/[name].bundle.js',
chunkFilename: 'dist/[id].chunk.js',
publicPath: '/'
},
resolve: {
extensions: ['.ts', ".tsx",'.js', '.json'],
alias: rxPaths()
},
devServer: {
historyApiFallback: true,
contentBase: path.join(ROOT, '/wwwroot/'),
watchOptions: {
aggregateTimeout: 300,
poll: 1000
}
},
module: {
rules: [
{
test: /\.tsx?$/,
use: [
'awesome-typescript-loader',
'angular-router-loader',
'angular2-template-loader',
'source-map-loader',
'tslint-loader'
]
},
{
test: /\.(png|jpg|gif|woff|woff2|ttf|svg|eot)$/,
use: 'file-loader?name=assets/[name]-[hash:6].[ext]'
},
{
test: /favicon.ico$/,
use: 'file-loader?name=/[name].[ext]'
},
{
test: /\.css$/,
use: ['style-loader', {
loader: 'css-loader',
options: {
sourceMap: true
}
}]
},
{
test: /\.scss$/,
include: path.join(ROOT, 'angularApp/styles'),
use: ['style-loader', {
loader: 'css-loader',
options: {
sourceMap: true
}
}, {
loader: 'sass-loader',
options: {
sourceMap: true
}
}]
},
{
test: /\.scss$/,
exclude: path.join(ROOT, 'angularApp/styles'),
use: ['raw-loader', {
loader: 'sass-loader',
options: {
sourceMap: true
}
}]
},
{
test: /\.html$/,
use: 'raw-loader'
}
],
exprContextCritical: false
},
plugins: [
function () {
this.plugin('watch-run', function (watching, callback) {
console.log(
'\x1b[33m%s\x1b[0m',
`Begin compile at ${new Date().toTimeString()}`
);
callback();
});
},
new webpack.optimize.ModuleConcatenationPlugin(),
new webpack.ProvidePlugin({
$: 'jquery',
jQuery: 'jquery',
'window.jQuery': 'jquery'
}),
new CleanWebpackPlugin({
cleanOnceBeforeBuildPatterns: ['./wwwroot/dist', './wwwroot/assets'],
root: ROOT
}),
new HtmlWebpackPlugin({
filename: 'index.html',
inject: 'body',
template: 'angularApp/index.html'
}),
new CopyWebpackPlugin([
{ from: './angularApp/images/*.*', to: 'assets/', flatten: true }
]),
new FilterWarningsPlugin({
exclude: /System.import/
})
]
};
"sourceMap": true в файле ts.config с devtool: 'inline-source -map 'и использование source-map-loader в плагинах для файлов ts должны вызывать включение файла карт, но их нигде не видно. Есть идеи?