Last active
August 14, 2017 02:41
-
-
Save pmunin/8411f9772f13b7c4d3b8c39d03832760 to your computer and use it in GitHub Desktop.
vscode problemMatcher for webpack + ts-loader + tslint-loader
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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": [] | |
} | |
] | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment