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 characters
| import * as helperModule from './my-helper-module.js' | |
| console.log("Welcome! Greetings from app.js. Let's learn Webpack2"); | |
| console.log(helperModule.greetings); |
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 characters
| ... | |
| ... | |
| .... | |
| entry: "./src/scripts/app.js", //relative to root of the application | |
| output: { | |
| filename: "./dist/app.bundle.js" //relative to root of the application | |
| }, | |
| watch:true, | |
| resolve: { extensions: [".js", ".ts"] }, | |
| ..... |
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 characters
| import * as helperModule from './my-helper-module'; | |
| import * as _ from 'lodash'; | |
| console.log("Welcome! Greetings from app.js. Let's learn Webpack2"); | |
| console.log(helperModule.greetings); | |
| var arr=[ 1, 2, 3]; | |
| _.each(arr,function(val) { | |
| console.log('Output from Lodash _.each for Element ' + val); |
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 characters
| var HtmlWebpackPlugin = require('html-webpack-plugin'); | |
| var package = require('../package.json'); | |
| module.exports = { | |
| entry: { | |
| app: "./src/scripts/app.js", | |
| vendor: Object.keys(package.dependencies) | |
| }, | |
| output: { | |
| filename: "./dist/[name].bundle.js" |
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 characters
| var HtmlWebpackPlugin = require('html-webpack-plugin'); | |
| var package = require('../package.json'); | |
| module.exports = { | |
| entry: { | |
| app: "./src/scripts/app.js", | |
| vendor: Object.keys(package.dependencies), | |
| settings: "./src/scripts/settings.js" | |
| }, | |
| output: { |
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 characters
| ... | |
| var CommonsChunkPlugin = require('webpack/lib/optimize/CommonsChunkPlugin'); | |
| .... | |
| plugins: [ | |
| new CommonsChunkPlugin({ | |
| name: 'shared', | |
| minChunks: 2 | |
| }), | |
| new HtmlWebpackPlugin({ | |
| hash: true, |
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 characters
| var HtmlWebpackPlugin = require('html-webpack-plugin'); | |
| var package = require('../package.json'); | |
| var CommonsChunkPlugin = require('webpack/lib/optimize/CommonsChunkPlugin'); | |
| var path = require("path"); | |
| module.exports = { | |
| entry: { | |
| vendor: Object.keys(package.dependencies), | |
| app: "./src/scripts/app.js", | |
| settings: "./src/scripts/settings.js" |
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 characters
| { | |
| .... | |
| .... | |
| "scripts": { | |
| "start": "webpack-dev-server --config './webpack/webpack.config.js'" | |
| }, | |
| .... | |
| .... | |
| } |
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 characters
| div { | |
| background-color:#99cc00; | |
| padding:10px; | |
| } |
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 characters
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <title><%= htmlWebpackPlugin.options.title %></title> | |
| </head> | |
| <body> | |
| <h1><%= htmlWebpackPlugin.options.myPageHeader %></h1> |