From 22e4705a9cde1ec45fac032721af6d47ef60566b Mon Sep 17 00:00:00 2001 From: Indrajith K L Date: Mon, 18 Dec 2017 17:02:00 +0530 Subject: initial commit --- webpack.config.js | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 webpack.config.js (limited to 'webpack.config.js') diff --git a/webpack.config.js b/webpack.config.js new file mode 100644 index 0000000..e88631d --- /dev/null +++ b/webpack.config.js @@ -0,0 +1,66 @@ +const webpack = require("webpack"); +const path = require("path"); +const HtmlWebpackPlugin = require("html-webpack-plugin"); +const DashboardPlugin = require("webpack-dashboard/plugin"); +const nodeEnv = process.env.NODE_ENV || "development"; +const isProd = nodeEnv === "production"; + +var config = { + devtool: isProd ? "hidden-source-map" : "source-map", + context: path.resolve("./src"), + entry: { + app: "./index.ts" + }, + output: { + path: path.resolve("./dist"), + filename: "vanilla-yo-notification.js", + sourceMapFilename: "vanilla-yo-notification.js.map", + devtoolModuleFilenameTemplate: function (info) { + return "file:///" + info.absoluteResourcePath; + } + }, + module: { + rules: [ + { + enforce: "pre", + test: /\.ts?$/, + exclude: ["node_modules"], + use: ["awesome-typescript-loader", "source-map-loader"] + }, + { test: /\.css$/, loaders: ["style-loader", "css-loader"] } + ] + }, + resolve: { + extensions: [".ts", ".js"] + }, + plugins: [ + new webpack.DefinePlugin({ + "process.env": { + // eslint-disable-line quote-props + NODE_ENV: JSON.stringify(nodeEnv) + } + }), + new webpack.optimize.UglifyJsPlugin({ + compress: { warnings: false }, + output: { comments: false }, + sourceMap: true + }), + new DashboardPlugin(), + new webpack.LoaderOptionsPlugin({ + options: { + tslint: { + emitErrors: true, + failOnHint: true + } + } + }) + ], + devServer: { + contentBase: path.join(__dirname, "dist/"), + compress: true, + port: 3000, + hot: true + } +}; + +module.exports = config; -- cgit v1.2.3