Issue 1:
Bug report

What is the current behavior?

Modules from internal library (also built with Webpack) is missing all exports and is missing from __webpack_modules__ when building with mode: development.

The same code works and the page is loading fine when building with mode: production and serving dist.

It seems like the dist bundle file is never "expanded" in __webpack_modules__.

If you look at the image you'll see that the bundle is an entry in __webpack_modules__, but the exported modules from said file is not appearing in the list when checking. The list consists om a bunch of modules from node_modules and the modules from the application using the library.

So when it looks for the module in __webpack_modules__ it will end up with undefined.

__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);

That will cause the following error:

Uncaught TypeError: Cannot read property 'call' of undefined
at __webpack_require__ (main.js:2793)
at eval (index.ts:30)
at Object../src/index.ts (index.js:2168)
at __nested_webpack_require_8364606__ (index.js:5397)
at eval (index.js:5436)
at eval (index.js:5437)
at webpackUniversalModuleDefinition (index.js:11)
at eval (index.js:18)
at Object.../web-lib-core/dist/index.js (lib.js:87)
at __webpack_require__ (main.js:2793)

The module is also missing all exports:

The code is present in the dist file (i have removed the contents):

/***/ "./src/metadata/oasbasicmetadataextensions.class.ts":
/*!**********************************************************!*\
!*** ./src/metadata/oasbasicmetadataextensions.class.ts ***!
\**********************************************************/
/*! flagged exports */
/*! export OasBasicMetadataTypeExtensionBase [provided] [no usage info] [missing usage info prevents renaming] */
/*! export __esModule [provided] [no usage info] [missing usage info prevents renaming] */
/*! other exports [not provided] [no usage info] */
/*! runtime requirements: __webpack_exports__, __webpack_require__ */
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {

"use strict";
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.OasBasicMetadataTypeExtensionBase = void 0;\r\nvar tslib_1 = __webpack_require__(/*! tslib */ \"../../node_modules/tslib/tslib.es6.js\");\r\nvar utils_1 = __webpack_require__(/*! ../utils */ \"./src/utils/index.ts\"); var OasBasicMetadataTypeExtensionBase = /** @class */ (function () {\r\n function OasBasicMetadataTypeExtensionBase(type, typeRef) {...}\r\nexports.OasBasicMetadataTypeExtensionBase = OasBasicMetadataTypeExtensionBase;//# sourceURL=webpack-internal:///./src/metadata/oasbasicmetadataextensions.class.ts\n");

/***/ })

Config files:

https://gist.github.com/JonWallsten/69c82a3eb7688cae285f9034a8699f5b

If the current behavior is a bug, please provide the steps to reproduce.

I will work on a repro, but we have a large complex monorepo with a lot of sensitive information. Will update issue when I have created a similar repo with minimal code.

What is the expected behavior?

Modules from our internal library, also built with Webpack, should be found in __webpack_modules__ and the site should load just fine like it does with mode: production.

Other relevant information:

webpack version:

Node.js version:

Operating System:

Additional tools:

Issue 2:
Do you want to request a feature or report a bug?

Report a bug (though i might just need to set a property somewhere - couldn't tell from the docs. I suspect this is related to natively supporting JSON modules now.)

What is the current behavior?

I have a loader which loads a JSON file and outputs JS code. When I try to use it with Webpack 4, I get a JSON parse error (webpack is trying to parse the outputted JS code as JSON)

ERROR in ./node_modules/config-loader!./src/config.json
Module parse failed: Unexpected token r in JSON at position 0
You may need an appropriate loader to handle this file type.
SyntaxError: Unexpected token r in JSON at position 0
at JSON.parse (<anonymous>:null:null)
at JsonParser.parse (/Users/jback/dev/plugin-build/node_modules/webpack/lib/JsonParser.js:16:21)
at doBuild.err (/Users/jback/dev/plugin-build/node_modules/webpack/lib/NormalModule.js:367:32)
at runLoaders (/Users/jback/dev/plugin-build/node_modules/webpack/lib/NormalModule.js:264:12)
at /Users/jback/dev/plugin-build/node_modules/loader-runner/lib/LoaderRunner.js:370:3
at iterateNormalLoaders (/Users/jback/dev/plugin-build/node_modules/loader-runner/lib/LoaderRunner.js:211:10)
at iterateNormalLoaders (/Users/jback/dev/plugin-build/node_modules/loader-runner/lib/LoaderRunner.js:218:10)
at /Users/jback/dev/plugin-build/node_modules/loader-runner/lib/LoaderRunner.js:233:3
at runSyncOrAsync (/Users/jback/dev/plugin-build/node_modules/loader-runner/lib/LoaderRunner.js:130:11)
at iterateNormalLoaders (/Users/jback/dev/plugin-build/node_modules/loader-runner/lib/LoaderRunner.js:229:2)
at Array.<anonymous> (/Users/jback/dev/plugin-build/node_modules/loader-runner/lib/LoaderRunner.js:202:4)
at Storage.finished (/Users/jback/dev/plugin-build/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:43:16)
at provider (/Users/jback/dev/plugin-build/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:79:9)
at /Users/jback/dev/plugin-build/node_modules/graceful-fs/graceful-fs.js:78:16
at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:511:3)

If the current behavior is a bug, please provide the steps to reproduce.

What is the expected behavior?

I can output JS code from my loader parsing a JSON file (maybe with an option saying I'm outputting JS instead of JSON)

If this is a feature request, what is motivation or use case for changing the behavior?

Please mention other relevant information such as the browser version, Node.js version, webpack version, and Operating System.

OSX 10.13.3, Node 8.9.4, Webpack 4