json vscode problemMatcher for webpack + ts-loader + tslint-loader
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了json vscode problemMatcher for webpack + ts-loader + tslint-loader相关的知识,希望对你有一定的参考价值。
import * as webpack from 'webpack';
import * as path from 'path';
declare var __dirname;
const config: webpack.Configuration = {
//devtool: 'inline-source-map',
entry: {
"lib": "./src/index.ts",
},
output: {
path: path.resolve(__dirname, 'dist'),
filename: '[name].bundle.js',
libraryTarget: "var", library: "MyLib"
},
resolve: {
extensions: ['.ts', '.js']
},
externals:
{
"jquery": "jQuery"
} as any
,
module: {
noParse: /jquery|lodash/,
rules: [
{
test: /\.tsx?$/,
enforce: 'pre',
loader: 'tslint-loader',
options: {
/* Loader options go here */
fix:true
}
},
{
test: /\.tsx?$/,//supports both ts and tsx (for react)
loader: 'babel-loader!ts-loader',
exclude: /node_modules/
},
{
test: /\.jsx?$/,//supports both js and jsx (for react)
exclude: /node_modules/,
loader: 'babel-loader',
},
{
test: /\.css$/,
loader: 'style-loader!css-loader',
//https://medium.com/@sapegin/css-modules-with-typescript-and-webpack-6b221ebe5f10
//loader: 'style-loader!typings-for-css-modules-loader?modules&namedExport',
exclude: /node_modules/
}
]
},
plugins: [
new webpack.optimize.UglifyJsPlugin({mangle:false, sourceMap:false}) //Does not work with es6
]
};
export default config;
// Latest version here: https://gist.github.com/pmunin/8411f9772f13b7c4d3b8c39d03832760
{
"version": "2.0.0",
"tasks": [
{
"taskName": "webpack",
"command": "webpack",
"type": "shell",
"args": [
"--display-modules"
],
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": [
{
"owner": "webpack",
"severity": "error",
"fileLocation": "absolute",
"pattern": [
{
"regexp": "^(ERROR|WARNING) in (\\w:(.*))$",
"severity": 1,
"file": 2,
"code": 2
},
{
"regexp": "^(\\(|\\[)\\s*(\\d+)\\s*,\\s*(\\d+)\\s*(\\)|\\]):(.*)|(.*)$",
"line": 2,
"column": 3,
"message": 5,
"loop":true
}
]
},
{
"owner": "webpack",
"severity": "error",
"fileLocation": ["relative","${workspaceRoot}"],
"pattern": [
{
"regexp": "^(ERROR|WARNING) in ([^:]*)$",
"severity": 1,
"file": 2,
"code": 2
},
{
"regexp": "^(\\(|\\[)\\s*(\\d+)\\s*,\\s*(\\d+)\\s*(\\)|\\]):(.*)|(.*)$",
"line": 2,
"column": 3,
"message": 5,
"loop":true
}
]
}
]
},
{
"taskName": "startHttp",
"type": "shell",
"command": "http-server -a localhost -o",
"problemMatcher": []
},
{
"type": "shell",
"command": "yarn install",
"taskName": "yarn: install",
"problemMatcher": []
}
]
}
以上是关于json vscode problemMatcher for webpack + ts-loader + tslint-loader的主要内容,如果未能解决你的问题,请参考以下文章
单击问题窗口时,在Visual Studio代码上找不到文件错误(使用make,gcc和gcc problemMatcher)