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

require CLI argument seems to be ignored #150

Closed
1 of 3 tasks
mhuggins opened this issue May 25, 2018 · 3 comments
Closed
1 of 3 tasks

require CLI argument seems to be ignored #150

mhuggins opened this issue May 25, 2018 · 3 comments

Comments

@mhuggins
Copy link

mhuggins commented May 25, 2018

  • Operating System: macOS High Sierra 10.13.3
  • Node Version: 8.9.3
  • NPM Version: 5.5.1
  • webpack Version: 4.8.3
  • webpack-serve Version: 1.0.2

This issue is for a:

  • bug
  • feature request
  • modification request

Code

CLI Command
$ webpack-serve --require babel-register --config config/webpack.babel.js
webpack.config.js
import path from 'path';
// snip...

Expected Behavior

Webpack config loads after babel-register loads.

Actual Behavior

require argument seems to be ignored & error is thrown:

✖ 「config」: An error ocurred while trying to load /Users/mhuggins/Development/nos/client/config/webpack.babel.js
              Did you forget to specify a --require?
/Users/mhuggins/Development/nos/client/node_modules/@webpack-contrib/config-loader/lib/load.js:84
    throw new LoadConfigError(e, configPath);
    ^

LoadConfigError: Unexpected token import
import path from 'path';
^^^^^^

SyntaxError: Unexpected token import
    at NativeCompileCache._moduleCompile (/Users/mhuggins/Development/nos/client/node_modules/v8-compile-cache/v8-compile-cache.js:226:18)
    at Module._compile (/Users/mhuggins/Development/nos/client/node_modules/v8-compile-cache/v8-compile-cache.js:172:36)
    at Object.Module._extensions..js (module.js:646:10)
    at Module.load (module.js:554:32)
    at tryModuleLoad (module.js:497:12)
    at Function.Module._load (module.js:489:3)
    at Module.require (module.js:579:17)
    at require (/Users/mhuggins/Development/nos/client/node_modules/v8-compile-cache/v8-compile-cache.js:159:20)
    at loadJs (/Users/mhuggins/Development/nos/client/node_modules/@webpack-contrib/config-loader/node_modules/cosmiconfig/dist/loaders.js:8:18)
    at Explorer.loadFileContent (/Users/mhuggins/Development/nos/client/node_modules/@webpack-contrib/config-loader/node_modules/cosmiconfig/dist/createExplorer.js:226:12)
error An unexpected error occurred: "Command failed.
Exit code: 1
Command: sh
Arguments: -c webpack-serve --require babel-register --config config/webpack.babel.js
Directory: /Users/mhuggins/Development/nos/client

How Do We Reproduce?

Try to --require babel-register along with an ES6 webpack config file.

Additionally, try replacing "babel-register" with literally any string, and it doesn't seem to be attempting to require the file regardless of name.

@shellscape
Copy link
Contributor

Duplicate of #140

@shellscape shellscape marked this as a duplicate of #140 May 25, 2018
@nisargrthakkar
Copy link

nisargrthakkar commented Jul 4, 2018

Is there any update on this? I am still getting this error

@shellscape
Copy link
Contributor

@nisargrthakkar this goes for the entirety of Github and every project on it: If you don't see replies / tags / associated issues and/or pull requests listed in an issue - There have been no updates. So there's no need to ask.

https://github.com/webpack-contrib/webpack-serve/commits/master - a fix was released in v1.0.4 on June 7th.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants