shama / webpack-stream

:tropical_drink: Run webpack through a stream interface
MIT License
1.4k stars 123 forks source link

webpack.config entry import syntax support #236

Closed jmarshall9120 closed 3 years ago

jmarshall9120 commented 3 years ago

The below syntax for entry doesn't seem to be supported. Can this be confirmed?

entry portion of my webpack.config.js

 entry: {
        index: {
            import: './src/index.js',
        },
        pageProductDetails: {
            import: './src/pageProductDetails.js',
        },
}

error:

WebpackOptionsValidationError: Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
 - configuration.entry should be one of these:
   function | object { <key>: non-empty string | [non-empty string] } | non-empty string | [non-empty string]
   -> The entry point(s) of the compilation.
   Details:
    * configuration.entry['pageProductDetails'] should be a string.
      -> The string is resolved to a module which is loaded upon startup.
    * configuration.entry['pageProductDetails'] should be an array:
      [non-empty string]
      -> A non-empty array of non-empty strings
    * configuration.entry['pageProductDetails'] should be one of these:
      [non-empty string]
      -> All modules are loaded upon startup. The last one is exported.
    * configuration.entry['pageProductDetails'] should be one of these:
      non-empty string | [non-empty string]
      -> An entry point with name
    at webpack (C:\Users\jmarshall\source\UniqueSite\node_modules\webpack-stream\node_modules\webpack\lib\webpack.js:31:9)
    at Stream.<anonymous> (C:\Users\jmarshall\source\UniqueSite\node_modules\webpack-stream\index.js:151:38)
    at _end (C:\Users\jmarshall\source\UniqueSite\node_modules\through\index.js:65:9)
    at Stream.stream.end (C:\Users\jmarshall\source\UniqueSite\node_modules\through\index.js:74:5)
    at module.exports (C:\Users\jmarshall\source\UniqueSite\node_modules\webpack-stream\index.js:247:12)
    at runWebpack (C:\Users\jmarshall\source\UniqueSite\gulpfile.js:212:5)
    at bound (domain.js:426:14)
    at runBound (domain.js:439:12)
    at asyncRunner (C:\Users\jmarshall\source\UniqueSite\node_modules\async-done\index.js:55:18)
    at processTicksAndRejections (internal/process/task_queues.js:79:11)

this syntax works just fine if I run webpack by itself. Docs here

jmarshall9120 commented 3 years ago

It was a version compatibility thing. Resolved it from this example in your docs here

const gulp = require('gulp');
const webpack = require('webpack');
const gulpWebpack = require('webpack-stream');
gulp.task('default', function() {
  return gulp.src('src/entry.js')
    .pipe(gulpWebpack({}, webpack))
    .pipe(gulp.dest('dist/'));
});