Skip to content
This repository has been archived by the owner on Dec 8, 2022. It is now read-only.

Node module updates #123

Merged
merged 3 commits into from
Sep 21, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
153 changes: 1 addition & 152 deletions config/webpack/webpack.common.js
Original file line number Diff line number Diff line change
@@ -1,109 +1,38 @@
/**
* @author: @AngularClass
*/

var webpack = require('webpack');
var helpers = require('../utils/helpers');

/*
* Webpack Plugins
*/
//var CopyWebpackPlugin = require('copy-webpack-plugin');
var ForkCheckerPlugin = require('awesome-typescript-loader').ForkCheckerPlugin;

var ExtractTextPlugin = require('extract-text-webpack-plugin');

var extractScss = new ExtractTextPlugin('sky.css');

/*
* Webpack Constants
*/
var METADATA = {
title: 'Angular2 Webpack Starter by @gdi2290 from @AngularClass',
title: 'SKY UX 2',
baseUrl: '/'
};

/*
* Webpack configuration
*
* See: http://webpack.github.io/docs/configuration.html#cli
*/
module.exports = {

/*
* Static metadata for index.html
*
* See: (custom attribute)
*/
metadata: METADATA,

/*
* Cache generated modules and chunks to improve performance for multiple incremental builds.
* This is enabled by default in watch mode.
* You can pass false to disable it.
*
* See: http://webpack.github.io/docs/configuration.html#cache
* cache: false,
*
* The entry point for the bundle
* Our Angular.js app
*
* See: http://webpack.github.io/docs/configuration.html#entry
*/
entry: {
'polyfills': './src/polyfills.ts',
'vendor': './src/vendor.ts'
},

/*
* Options affecting the resolving of modules.
*
* See: http://webpack.github.io/docs/configuration.html#resolve
*/
resolve: {

/*
* An array of extensions that should be used to resolve modules.
*
* See: http://webpack.github.io/docs/configuration.html#resolve-extensions
*/
extensions: ['', '.ts', '.js'],

// Make sure root is src
root: helpers.root('src'),

// remove other default values
modulesDirectories: ['node_modules']

},

/*
* Options affecting the normal modules.
*
* See: http://webpack.github.io/docs/configuration.html#module
*/
module: {

/*
* An array of applied pre and post loaders.
*
* See: http://webpack.github.io/docs/configuration.html#module-preloaders-module-postloaders
*/
preLoaders: [

/*
* Tslint loader support for *.ts files
*
* See: https://github.com/wbuchwalter/tslint-loader
*/
// { test: /\.ts$/, loader: 'tslint-loader', exclude: [ helpers.root('node_modules') ] },

/*
* Source map loader support for *.js files
* Extracts SourceMaps for source files that as added as sourceMappingURL comment.
*
* See: https://github.com/webpack/source-map-loader
*/
{
test: /\.js$/,
loader: 'source-map-loader',
Expand All @@ -116,14 +45,6 @@ module.exports = {

],

/*
* An array of automatically applied loaders.
*
* IMPORTANT: The loaders here are resolved relative to the resource which they are applied to.
* This means they are not resolved relative to the configuration file.
*
* See: http://webpack.github.io/docs/configuration.html#module-loaders
*/
loaders: [

{
Expand All @@ -132,33 +53,16 @@ module.exports = {
exclude: [/\.(spec|e2e)\.ts$/]
},

/*
* Json loader support for *.json files.
*
* See: https://github.com/webpack/json-loader
*/
{
test: /\.json$/,
loader: 'json-loader'
},

/*
* Raw loader support for *.css files
* Returns file content as string
*
* See: https://github.com/webpack/raw-loader
*/
{
test: /\.css$/,
loader: 'raw-loader'
},

/*
* Raw loader support for *.css files
* Returns file content as string
*
* See: https://github.com/webpack/raw-loader
*/
{
test: /\.scss$/,
loader: 'raw-loader!sass-loader',
Expand All @@ -172,19 +76,12 @@ module.exports = {
loader: extractScss.extract(['css', 'sass'])
},

/* Raw loader support for *.html
* Returns file content as string
*
* See: https://github.com/webpack/raw-loader
*/
{
test: /\.html$/,
loader: 'raw-loader',
exclude: [helpers.root('src/index.html')]
},

// the url-loader uses DataUrls.
// the file-loader emits files.
{
test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/,
loader: 'url-loader?limit=10000&mimetype=application/font-woff'
Expand All @@ -203,66 +100,18 @@ module.exports = {

},

/*
* Add additional plugins to the compiler.
*
* See: http://webpack.github.io/docs/configuration.html#plugins
*/
plugins: [

extractScss,

/*
* Plugin: ForkCheckerPlugin
* Description: Do type checking in a separate process, so webpack don't need to wait.
*
* See: https://github.com/s-panferov/awesome-typescript-loader#forkchecker-boolean-defaultfalse
*/
new ForkCheckerPlugin(),

/*
* Plugin: OccurenceOrderPlugin
* Description: Varies the distribution of the ids to get the smallest id length
* for often used ids.
*
* See: https://webpack.github.io/docs/list-of-plugins.html#occurrenceorderplugin
* See: https://github.com/webpack/docs/wiki/optimization#minimize
*/
new webpack.optimize.OccurenceOrderPlugin(true),

/*
* Plugin: CommonsChunkPlugin
* Description: Shares common code between the pages.
* It identifies common modules and put them into a commons chunk.
*
* See: https://webpack.github.io/docs/list-of-plugins.html#commonschunkplugin
* See: https://github.com/webpack/docs/wiki/optimization#multi-page-app
*/
new webpack.optimize.CommonsChunkPlugin({
name: helpers.reverse(['polyfills', 'vendor'])
}),

/*
* Plugin: CopyWebpackPlugin
* Description: Copy files and directories in webpack.
*
* Copies project static assets.
*
* See: https://www.npmjs.com/package/copy-webpack-plugin
*/
// new CopyWebpackPlugin([{
// from: 'src/assets',
// to: 'assets'
// }])

],

/*
* Include polyfills or mocks for various node stuff
* Description: Node configuration
*
* See: https://webpack.github.io/docs/configuration.html#node
*/
node: {
global: 'window',
crypto: 'empty',
Expand Down
18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,15 @@
"core-js": "2.4.1",
"dragula": "3.7.2",
"font-awesome": "4.6.3",
"ng2-dragula": "1.2.0",
"ng2-dragula": "1.2.1",
"ng2-toastr": "0.3.1",
"rxjs": "5.0.0-beta.12",
"zone.js": "0.6.23"
},
"devDependencies": {
"@types/core-js": "0.9.32",
"@types/jasmine": "2.2.33",
"@types/node": "6.0.38",
"@types/core-js": "0.9.33",
"@types/jasmine": "2.2.34",
"@types/node": "6.0.39",
"@types/webpack": "1.12.34",
"axe-core": "2.0.5",
"base64-image-loader": "1.0.0",
Expand All @@ -66,23 +66,23 @@
"file-loader": "0.9.0",
"font-awesome-webpack": "0.0.4",
"fs-extra": "0.30.0",
"glob": "7.0.6",
"glob": "7.1.0",
"html-webpack-plugin": "2.22.0",
"http-server": "0.9.0",
"istanbul-instrumenter-loader": "0.2.0",
"jasmine": "2.5.1",
"jasmine": "2.5.2",
"json-loader": "0.5.4",
"karma": "1.2.0",
"karma": "1.3.0",
"karma-browserstack-launcher": "1.1.1",
"karma-chrome-launcher": "2.0.0",
"karma-coverage": "1.1.1",
"karma-jasmine": "1.0.2",
"karma-mocha-reporter": "2.1.0",
"karma-mocha-reporter": "2.2.0",
"karma-sourcemap-loader": "0.3.7",
"karma-webpack": "1.8.0",
"less": "2.7.1",
"node-resemble-js": "0.0.5",
"node-sass": "3.9.3",
"node-sass": "3.10.0",
"normalize-scss": "5.0.3",
"raw-loader": "0.5.1",
"remap-istanbul": "devCrossNet/remap-istanbul",
Expand Down