Skip to content

Instantly share code, notes, and snippets.

@pmunin
Last active August 14, 2017 02:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pmunin/8411f9772f13b7c4d3b8c39d03832760 to your computer and use it in GitHub Desktop.
Save pmunin/8411f9772f13b7c4d3b8c39d03832760 to your computer and use it in GitHub Desktop.
vscode problemMatcher for webpack + ts-loader + tslint-loader
// 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": []
}
]
}
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