Skip to content

Commit

Permalink
add webpack
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael J. Currie committed Sep 23, 2019
1 parent c4afc73 commit 2de6b1f
Show file tree
Hide file tree
Showing 4 changed files with 1,850 additions and 44 deletions.
11 changes: 9 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
"version": "0.4.0",
"description": "A Razor class library for interacting with the browser visibility API",
"scripts": {
"build": "tsc",
"build": "SET NODE_ENV=production && webpack -p --color",
"build:tsc": "tsc",
"watch": "webpack --watch",
"lint": "eslint ./src --ext .ts",
"prettier:write": "prettier --write ./src/*.ts",
"prettier:check": "prettier --check ./src/*.ts",
Expand All @@ -17,11 +19,16 @@
"@types/node": "^12.7.5",
"@typescript-eslint/eslint-plugin": "^2.3.0",
"@typescript-eslint/parser": "^2.3.0",
"babel-loader": "^8.0.6",
"clean-webpack-plugin": "^3.0.0",
"eslint": "^6.4.0",
"eslint-config-prettier": "^6.3.0",
"prettier": "^1.18.2",
"terser-webpack-plugin": "^2.1.0",
"tslint": "^5.19.0",
"typescript": "^3.6.2"
"typescript": "^3.6.2",
"webpack": "^4.40.2",
"webpack-cli": "^3.3.9"
},
"browserslist": [
"ie 10",
Expand Down
25 changes: 10 additions & 15 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,16 @@
{
"compilerOptions": {
"noImplicitAny": false,
"noEmitOnError": true,
"removeComments": false,
"outDir": "./wwwroot/",
"sourceMap": false,
"target": "es5",
"lib": [
"es2015",
"dom"
],
"allowSyntheticDefaultImports": true,
"noImplicitAny": false,
"esModuleInterop": true,
"target": "esnext",
"strict": true,
"outDir": "./wwwroot/"
"moduleResolution": "node",
"noEmit": true,
"lib": ["es2015", "dom"],
"allowJs": true
},
"exclude": [
"node_modules"
],
"include": [
"**/*.ts"
]
"include": ["./src/*.ts"]
}
33 changes: 33 additions & 0 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
const path = require("path");
const TerserJSPlugin = require("terser-webpack-plugin");
const { CleanWebpackPlugin } = require("clean-webpack-plugin");

module.exports = {
entry: {
pagevisibility: "./src/pagevisibility.ts",
"pagevisibility.min": "./src/pagevisibility.ts"
},
output: {
filename: "[name].js",
path: path.resolve(__dirname, "wwwroot")
},
module: {
rules: [
{
test: /\.ts$/,
use: "babel-loader",
exclude: /node_modules/
}
]
},
plugins: [
new CleanWebpackPlugin()
],
optimization: {
minimizer: [
new TerserJSPlugin({
include: /\.min\.js$/
})
]
}
};
Loading

0 comments on commit 2de6b1f

Please sign in to comment.