Ncc: nconf-issue with 0.20.4 (0.18.5 worked)

Created on 4 Jul 2019  路  5Comments  路  Source: vercel/ncc

Running my app with 0.18.5 worked, after updating to 0.20.4 it does not start anymore:

Here is the error when I try to start the app:

C:\dev\daqmon\dist\apps\server\nccdist\main.js:295376
        return __ncc_wildcard$0(store)[name];
                                      ^
TypeError: Cannot read property 'Argv' of undefined
    at module.exports.exports.Provider.Argv (C:\dev\daqmon\dist\apps\server\nccdist\main.js:295376:39)
    at module.exports.exports.Provider.module.exports.Provider.add (C:\dev\daqmon\dist\apps\server\nccdist\main.js:12735:33)
    at module.exports.exports.Provider.Provider.(anonymous function) [as argv] (C:\dev\daqmon\dist\apps\server\nccdist\main.js:
12642:21)

Here is some - maybe related - output the compiler:

ncc: Version 0.20.4
ncc: Compiling file index.js
Generating wildcard requires for C:\dev\daqmon\node_modules\nconf\lib\nconf\stores\*

Here is some related code of the ncc output .js files

Version 0.20.4 - not working

/*
 * nconf.js: Top-level include for the nconf module
 *
 * (C) 2011, Charlie Robbins and the Contributors.
 *
 */

function __ncc_wildcard$0 (arg) {
  if (arg === "argv.js") return __webpack_require__(7509);
  else if (arg === "env.js") return __webpack_require__(7653);
  else if (arg === "file.js") return __webpack_require__(5501);
  else if (arg === "literal.js") return __webpack_require__(3680);
  else if (arg === "memory.js") return __webpack_require__(4880);
}
var common = __webpack_require__(3675),
    Provider = __webpack_require__(332).Provider;

//
// `nconf` is by default an instance of `nconf.Provider`.
//
var nconf = module.exports = new Provider();

//
// Expose the version from the package.json
//
nconf.version = __webpack_require__(2325).version;

//
// Setup all stores as lazy-loaded getters.
//
['argv', 'env', 'file', 'literal', 'memory'].forEach(function (store) {
    var name = common.capitalize(store);

    nconf.__defineGetter__(name, function () {
        return __ncc_wildcard$0(store)[name];
    });
});

Version 0.18.05 - working:

/*
 * nconf.js: Top-level include for the nconf module
 *
 * (C) 2011, Charlie Robbins and the Contributors.
 *
 */

var common = __webpack_require__(6129),
    Provider = __webpack_require__(1699).Provider;

//
// `nconf` is by default an instance of `nconf.Provider`.
//
var nconf = module.exports = new Provider();

//
// Expose the version from the package.json
//
nconf.version = __webpack_require__(8112).version;

//
// Setup all stores as lazy-loaded getters.
//
['argv', 'env', 'file', 'literal', 'memory'].forEach(function (store) {
    var name = common.capitalize(store);

    nconf.__defineGetter__(name, function () {
        return __webpack_require__(3012)("./" + store)[name];
    });
});
bug

All 5 comments

@tmtron thanks for posting such a very clear replication here. I've put together a fix for this in https://github.com/zeit/webpack-asset-relocator-loader/pull/65, it should make its way downstream some time over the next week.

@guybedford We still see this issue in ncc 0.20.5. Maybe this version still uses the old loader?

@tmtron looks like guy isn't a maintainer anymore ++ @Timer

Hi,

Just tried to upgrade to latest version (I was using 0.18.5) and also bumped into this issue!
I can also confirm it is still not working in 0.21.1!

Please fix it...

this is fixed in version 0.22.2

Was this page helpful?
0 / 5 - 0 ratings

Related issues

drewolson picture drewolson  路  3Comments

guybedford picture guybedford  路  4Comments

maku picture maku  路  3Comments

rgbkrk picture rgbkrk  路  3Comments

paulogdm picture paulogdm  路  5Comments