diff options
author | Indrajith K L | 2017-12-18 17:02:00 +0530 |
---|---|---|
committer | Indrajith K L | 2017-12-18 17:02:00 +0530 |
commit | 22e4705a9cde1ec45fac032721af6d47ef60566b (patch) | |
tree | b2da1d0f49c725e3032ed1ad14b2118d2c3ca482 /webpack.config.js | |
download | vanilla-yo-notification-22e4705a9cde1ec45fac032721af6d47ef60566b.tar.gz vanilla-yo-notification-22e4705a9cde1ec45fac032721af6d47ef60566b.tar.bz2 vanilla-yo-notification-22e4705a9cde1ec45fac032721af6d47ef60566b.zip |
initial commit
Diffstat (limited to 'webpack.config.js')
-rw-r--r-- | webpack.config.js | 66 |
1 files changed, 66 insertions, 0 deletions
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; |