Browse Source

update to webpack2

Robin Herbots 8 years ago
parent
commit
db462ccb14
3 changed files with 49 additions and 30 deletions
  1. 1 1
      js/inputmask.numeric.extensions.js
  2. 9 9
      package.json
  3. 39 20
      webpack.config.js

+ 1 - 1
js/inputmask.numeric.extensions.js

@@ -444,7 +444,7 @@
 				":": {
 					validator: function (chrs, maskset, pos, strict, opts) {
 						var radix = "[" + Inputmask.escapeRegex(opts.radixPoint) + "]";
-						isValid = new RegExp(radix).test(chrs);
+						var isValid = new RegExp(radix).test(chrs);
 						if (isValid && maskset.validPositions[pos] && maskset.validPositions[pos].match.placeholder === opts.radixPoint) {
 							isValid = {
 								"caret": pos + 1

+ 9 - 9
package.json

@@ -46,16 +46,16 @@
     "grunt-bump": "^0.8.0",
     "grunt-cli": "^1.2.0",
     "grunt-contrib-clean": "^1.0.0",
-    "grunt-contrib-uglify": "^1.0.1",
+    "grunt-contrib-uglify": "^2.2.1",
     "grunt-eslint": "^19.0.0",
     "grunt-karma": "^2.0.0",
-    "grunt-nuget": "^0.1.5",
+    "grunt-nuget": "^0.2.0",
     "grunt-release": "^0.14.0",
-    "grunt-shell": "^1.1.2",
+    "grunt-shell": "^2.1.0",
     "jqlite": "^0.2.25",
     "jquery": "^3.2.1",
     "karma": "^1.1.1",
-    "karma-chrome-launcher": "^1.0.1",
+    "karma-chrome-launcher": "^2.0.0",
     "karma-firefox-launcher": "^1.0.0",
     "karma-ie-launcher": "^1.0.0",
     "karma-phantomjs-launcher": "^1.0.0",
@@ -65,12 +65,12 @@
     "phantomjs-prebuilt": "^2.1.14",
     "postcss": "^5.0.21",
     "postcss-cssnext": "^2.6.0",
-    "postcss-loader": "^0.9.1",
-    "qunitjs": "^1.23.1",
+    "postcss-loader": "^1.3.3",
+    "qunitjs": "^2.3.0",
     "requirejs": "^2.1.20",
-    "source-map-loader": "^0.1.5",
+    "source-map-loader": "^0.2.1",
     "style-loader": "^0.16.1",
-    "webpack": "^1.13.1",
-    "webpack-dev-server": "^1.14.1"
+    "webpack": "^2.0.0",
+    "webpack-dev-server": "^2.0.0"
   }
 }

+ 39 - 20
webpack.config.js

@@ -1,7 +1,6 @@
 'use strict';
 
 let webpack = require('webpack');
-let postcss_cssnext = require('postcss-cssnext');
 let path = require('path');
 
 function _path(p) {
@@ -15,18 +14,17 @@ module.exports = {
 		filename: "build/bundle.js"
 	},
 	module: {
-		preLoaders: [
+		rules: [
 			{
+				enforce: 'pre',
 				test: /\.js$/,
-				loader: 'source-map',
+				loader: 'source-map-loader',
 			},
-		],
-		loaders: [
 			{
 				test: /\.js$/,
-				loader: 'babel',
+				loader: 'babel-loader',
 				exclude: /(node_modules)/,
-				query: {
+				options: {
 					presets: [
 						'es2015',
 						'stage-0',
@@ -36,28 +34,49 @@ module.exports = {
 			},
 			{
 				test: /\.css$/,
-				loader: 'style!css?importLoaders=1!postcss',
-			},
+				use: [
+					'style-loader',
+					{
+						loader: 'css-loader',
+						options: {
+							importLoaders: 1
+						}
+					},
+					{
+						loader: 'postcss-loader',
+						options: {
+							plugins: function () {
+								return [
+									require('postcss-cssnext')
+								];
+							}
+						}
+					}
+				]
+			}
 		]
 	},
-	postcss: [postcss_cssnext],
 	resolve: {
-		alias: {
-		}
+		alias: {}
 	},
 	plugins: [
-		new webpack.SourceMapDevToolPlugin(
-			'[file].map', null,
-			'[absolute-resource-path]',
-			'[absolute-resource-path]'
-		),
+		new webpack.SourceMapDevToolPlugin({
+			// file and reference
+			filename: '[file].map',
+			// sources naming
+			moduleFilenameTemplate: '[absolute-resource-path]',
+			fallbackModuleFilenameTemplate: '[absolute-resource-path]',
+		}),
+		new webpack.LoaderOptionsPlugin({
+			debug: true
+		})
 	],
 	bail: true,
-	debug: true,
 	devServer: {
 		publicPath: '/',
-		outputPath: _path('build'),
-		stats: {colors: true},
+		stats: {
+			colors: true
+		},
 		host: '0.0.0.0',
 		inline: true,
 		port: '8080',