Reputation:
I'm trying to task webpack from gulp to process a directory that contains .js files. I'm using gulp-webpack 1.5.0. Gulp task is defined as:
return gulp.src(joinPath(config.aliasify.dest, 'index.js'))
.pipe(webpack( require('./_____webpack.config.js') ))
.pipe(gulp.dest('dist/'));
_____webpack.config.js is:
var debug = process.env.NODE_ENV !== "production";
var webpack = require('webpack');
module.exports = {
stats: {
// Configure the console output
errorDetails: true,
colors: true,
modules: true,
reasons: true
},
progress: true,
entry: "./out/js/index.js",
output: {
filename: "bundle.js",
path: __dirname + "/dist"
}
}
It fails miserably. There seems to be problems with JSON files :
ERROR in ./~/aws-sdk/apis/cognito-idp-2016-04-18.paginators.json Module parse failed: /Users/omatrot/Projects/trash/reactxp/samples/hello-world/node_modules/aws-sdk/apis/cognito-idp-2016-04-18.paginators.json Unexpected token (2:14) You may need an appropriate loader to handle this file type. SyntaxError: Unexpected token (2:14)
Running webpack on the same directory with the-apparently- same configuration works fine.
webpack.config.ts file is:
import * as webpack from 'webpack';
const config: webpack.Configuration = {
entry: "./out/js/index.js",
output: {
filename: "bundle.js",
path: __dirname + "/dist"
},
};
export default config;
webpack --display-error-details --progress --colors
Hash: 0a378df14f58624d244f Version: webpack 2.2.1 Time: 3920ms Asset Size Chunks Chunk Names bundle.js 3.07 MB 0 [emitted] [big] main bundle.js.map 3.71 MB 0 [emitted] main [8] ./~/reactxp/index.js 146 bytes {0} [built] [112] ./out/js/ExercisesStore.js 3.29 kB {0} [built] [120] ./~/amazon-cognito-identity-js/es/CognitoRefreshToken.js 1.4 kB {0} [built] [126] ./~/amazon-cognito-identity-js/es/index.js 1.58 kB {0} [built] [217] ./out/js/App3.js 14.4 kB {0} [built] [278] ./~/jwt-decode/lib/index.js 680 bytes {0} [built] [490] ./out/js/AlertAndPromptWeb.js 3.4 kB {0} [built] [494] ./out/js/EditExerciseAttributePropertiesPanel.js 10.4 kB {0} [built] [495] ./out/js/EditExerciseAttributesValuesPanel.js 9.4 kB {0} [built] [496] ./out/js/EditExerciseCategoryPropertiesPanel.js 5.78 kB {0} [built] [497] ./out/js/EditExerciseMainPropertiesPanel.js 4.91 kB {0} [built] [498] ./out/js/ExercicesTopLevelView.js 13.7 kB {0} [built] [502] ./out/js/LogHelper.js 791 bytes {0} [built] [504] ./out/js/asynccognito.js 2.08 kB {0} [built] [505] ./out/js/index.js 599 bytes {0} [built] + 491 hidden modules
I'm doing it wrong but I can't find what it is.
Any help appreciated.
Upvotes: 1
Views: 666
Reputation:
Ok, while reinstalling node modules I was presented a warning message that led me to a resolution:
npm WARN deprecated [email protected]: Renamed to https://www.npmjs.com/package/webpack-stream
So I switched to this module and it worked immediately, after removal of the progress configuration option that is deprecated.
Upvotes: 2