aboutsummaryrefslogtreecommitdiff
path: root/webpack.config.js
diff options
context:
space:
mode:
Diffstat (limited to 'webpack.config.js')
-rw-r--r--webpack.config.js66
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;