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

--require and -r options are broken #140

Closed
jdalton opened this issue May 16, 2018 · 9 comments · Fixed by #153
Closed

--require and -r options are broken #140

jdalton opened this issue May 16, 2018 · 9 comments · Fixed by #153

Comments

@jdalton
Copy link

jdalton commented May 16, 2018

Reposting as a new issue from #138 (comment):

Ok, after digging into this a bit the issue does appear to be a webpack-serve issue.

webpack-serve receives the -r or --require as options.flags but then does not pass them off to config-loader which expects a options.require.

Receiving as options.flags

webpack-serve/cli.js

Lines 71 to 74 in f7842c4

const flags = Object.assign({}, cli.flags);
const explorer = cosmiconfig('serve', {});
const { config } = explorer.searchSync() || {};
const options = merge({ flags }, config);

Still options.flags

const flags = opts.flags || {};
const nodeVersion = parseInt(process.version.substring(1), 10);
return load(opts).then((configs) => {

Passing to config-loader as options.require

const { compiler, config, require } = options;
// if someone passed us a config Object, then just resolve that object
// we're only going to load the config from file when we're given a file
// to load
if (isPlainObject(config) || Array.isArray(config)) {
const result = [].concat(config).map((conf) => prepare(conf));
return Promise.resolve(result);
}
// if a user has passed us a compiler directly, then pull the config from
// the compiler and use that
if (compiler) {
let configs = [];
if (compiler instanceof MultiCompiler) {
const { compilers } = compiler;
configs = compilers.map((c) => c.options);
} else {
configs = [compiler.options];
}
return Promise.resolve(configs);
}
const loaderOptions = {
allowMissing: true,
require,

@shellscape
Copy link
Contributor

Resolved in 9ef5b29

@jdalton
Copy link
Author

jdalton commented May 17, 2018

Thank you @shellscape!

@oles
Copy link

oles commented May 17, 2018

Awesome - thank you both ❤️

@alexperrault
Copy link

Thank you for the hard work !
@shellscape, any chance this hotfix could be released before the rest of the branch it is currently on (test/ava) ?

@shellscape
Copy link
Contributor

@alexperrault no, sorry. Please have patience.

@jdalton
Copy link
Author

jdalton commented Jun 6, 2018

Hi @shellscape!

Is there anything I can help with?

@shellscape
Copy link
Contributor

shellscape commented Jun 6, 2018

Nope. https://github.com/webpack-contrib/webpack-serve/commits/master (and the PR that resolved this is displayed hovering directly above your last reply in this thread)

@jdalton
Copy link
Author

jdalton commented Jun 6, 2018

Oh, I know it was merged 😋
I was more asking if there's anything I can help with to bump the release is all.

@shellscape
Copy link
Contributor

@jdalton that's just a passive-aggressive alternative to asking when the release will be published. please refrain from that in the future, it is not welcome.

@webpack-contrib webpack-contrib locked as resolved and limited conversation to collaborators Jun 6, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants