Last active
February 7, 2020 23:27
-
-
Save ByJC/85c58e0d71f4548bde96 to your computer and use it in GitHub Desktop.
Revisions
-
ByJC revised this gist
Mar 18, 2016 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -53,7 +53,7 @@ module.exports = { }, { test: /\.js$/, exclude: /node_modules/, loader: "babel" }, { test: [ /\.svg/, -
ByJC revised this gist
Mar 18, 2016 . 1 changed file with 0 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -69,11 +69,5 @@ module.exports = { } ] }, plugins: pluginsWebpack }; -
ByJC created this gist
Mar 18, 2016 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,79 @@ var path = require('path'), webpack = require("webpack"), libPath = path.join(__dirname, 'lib'), wwwPath = path.join(__dirname, 'www'), pkg = require('./package.json'), HtmlWebpackPlugin = require('html-webpack-plugin'), ExtractTextPlugin = require("extract-text-webpack-plugin"); var bundleCss = ("production" === process.env.NODE_ENV) ? "bundle-[hash:6].css" : "bundle.css"; var pluginsWebpack = [ new ExtractTextPlugin(bundleCss), new HtmlWebpackPlugin({ filename: 'index.html', pkg: pkg, template: path.join(libPath, 'index.html') }) ]; if (process.env.NODE_ENV === "production") { var prodEnv = [ new webpack.optimize.OccurenceOrderPlugin(), new webpack.optimize.UglifyJsPlugin(), new webpack.optimize.DedupePlugin() ]; pluginsWebpack.concat(pluginsWebpack, prodEnv); } module.exports = { entry: path.join(libPath, 'index.js'), devtool: ("production" === process.env.NODE_ENV) ? "source-map" : "eval-source-map", output: { path: path.join(wwwPath), filename: ("production" === process.env.NODE_ENV) ? 'bundle-[hash:6].js' : 'bundle.js' }, babel: { presets: ['es2015'] }, module: { loaders: [ { test: /\.html$/, loader: ("production" === process.env.NODE_ENV) ? 'file?name=templates/[name]-[hash:6].html' : 'file?name=templates/[name].html' }, { test: /\.(png|jpg|gif)$/, loader: 'file?name=img/[name].[ext]' // inline base64 URLs for <=10kb images, direct URLs for the rest }, { test: /\.css$/, loader: ExtractTextPlugin.extract("style", "css!postcss") }, { test: /\.scss$/, loader: ExtractTextPlugin.extract("style", "css!postcss!sass") }, { test: /\.js$/, exclude: /node_modules/, loader: "ng-annotate?add=true!babel" }, { test: [ /\.svg/, /\.eot/, /\.ttf/, /\.woff/, /\.woff2/ ], loader: 'file?name=fonts/[name].[ext]' }, { test: /\.(json)$/, loader: 'json' // inline base64 URLs for <=10kb images, direct URLs for the rest } ] }, resolve: { alias: { txt: 'raw-loader', img: path.join(__dirname, 'lib/img') } }, plugins: pluginsWebpack };