Last active
April 25, 2017 20:59
-
-
Save jamesmfriedman/74cdc354560df65b7b8a19359f4ba8d8 to your computer and use it in GitHub Desktop.
Revisions
-
jamesmfriedman revised this gist
Apr 25, 2017 . No changes.There are no files selected for viewing
-
jamesmfriedman revised this gist
Apr 25, 2017 . 1 changed file with 17 additions and 17 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 @@ -2,9 +2,9 @@ const webpack = require('webpack'); const HtmlWebpackPlugin = require('html-webpack-plugin'); module.exports = function(env) { // merge together build and environment variables // to be made available in process.env const processEnv = Object.assign({}, env, require('./env.' + env.NODE_ENV)); // define our entries const entries = { @@ -18,22 +18,22 @@ module.exports = function(env) { } return { entry: entries output: {...}, module: {...}, devServer: {...} plugins: [ // This will generate an index.html file for us and emit it into our // output director new HtmlWebpackPlugin({ filename: 'index.html', template: 'src/index.ejs' //point our template to a .ejs file }), // we need process.env available in our template new webpack.DefinePlugin({ 'process.env': JSON.stringify(processEnv) }), ] } }; -
jamesmfriedman revised this gist
Apr 25, 2017 . No changes.There are no files selected for viewing
-
jamesmfriedman revised this gist
Apr 25, 2017 . No changes.There are no files selected for viewing
-
jamesmfriedman revised this gist
Apr 25, 2017 . No changes.There are no files selected for viewing
-
jamesmfriedman created this gist
Apr 25, 2017 .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,39 @@ const webpack = require('webpack'); const HtmlWebpackPlugin = require('html-webpack-plugin'); module.exports = function(env) { // merge together build and environment variables // to be made available in process.env const processEnv = Object.assign({}, env, require('./env.' + env.NODE_ENV)); // define our entries const entries = { 'polyfills': ['./src/polyfills.ts'], 'app': ['./src/main.ts'] }; // add in the styles js file if we're doing dev if (~process.env.BUILD_ENV.search('dev')) { entries['styles'] = ['./src/styles.js']; } return { entry: entries output: {...}, module: {...}, devServer: {...} plugins: [ // This will generate an index.html file for us and emit it into our // output director new HtmlWebpackPlugin({ filename: 'index.html', template: 'src/index.ejs' //point our template to a .ejs file }), // we need process.env available in our template new webpack.DefinePlugin({ 'process.env': JSON.stringify(processEnv) }), ] } };