bootstrap.native-loader icon indicating copy to clipboard operation
bootstrap.native-loader copied to clipboard

Module build failed, but rest of build still completes

Open filipkis opened this issue 5 years ago • 2 comments

Hi,

First of all, thanks for building this loader. We've been using it now for some time without any problems, only to stumble upon issue some days ago that took some time to debug.

We are using a custom build of bootstrap.native with just a few modules. The problem was that bootstrap.native uses uglify-js as dev dependency and everything worked fine until recently because we had another dependency that was using it so it was available for the build. However, now we updated that dependency and bootstrap.native couldn't anymore do the custom build.

However, our webpack bundle build actually didn't fail (though the loader did throw the error in the output - copied below). Which then caused the bundle to fail when used in browser.

Our fix was easy. We just included uglify-js as our dev dependency, but it would be great if in future the whole bundle failed so we can detect it earier.

ERROR in ./node_modules/bootstrap.native/dist/bootstrap-native.js
Module build failed (from ./node_modules/bootstrap.native-loader/index.js):
Error: Cannot find module 'uglify-js'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:580:15)
    at Function.Module._load (internal/modules/cjs/loader.js:506:25)
    at Module.require (internal/modules/cjs/loader.js:636:17)
    at require (./node_modules/v8-compile-cache/v8-compile-cache.js:161:20)
    at Object.<anonymous> (./node_modules/bootstrap.native/lib/build-module.js:2:14)
    at Module._compile (./node_modules/v8-compile-cache/v8-compile-cache.js:192:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
    at Module.load (internal/modules/cjs/loader.js:598:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
    at Function.Module._load (internal/modules/cjs/loader.js:529:3)
    at Module.require (internal/modules/cjs/loader.js:636:17)
    at require (./node_modules/v8-compile-cache/v8-compile-cache.js:161:20)
    at Object.<anonymous> (./node_modules/bootstrap.native-loader/index.js:1:75)
    at Module._compile (./node_modules/v8-compile-cache/v8-compile-cache.js:192:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
    at Module.load (internal/modules/cjs/loader.js:598:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
    at Function.Module._load (internal/modules/cjs/loader.js:529:3)
    at Module.require (internal/modules/cjs/loader.js:636:17)
    at require (./node_modules/v8-compile-cache/v8-compile-cache.js:161:20)
    at loadLoader (./node_modules/loader-runner/lib/loadLoader.js:18:17)
    at iteratePitchingLoaders (./node_modules/loader-runner/lib/LoaderRunner.js:169:2)
    at iteratePitchingLoaders (./node_modules/loader-runner/lib/LoaderRunner.js:165:10)
    at ./node_modules/loader-runner/lib/LoaderRunner.js:176:18
    at loadLoader (./node_modules/loader-runner/lib/loadLoader.js:47:3)
    at iteratePitchingLoaders (./node_modules/loader-runner/lib/LoaderRunner.js:169:2)
    at runLoaders (./node_modules/loader-runner/lib/LoaderRunner.js:365:2)
    at NormalModule.doBuild (./node_modules/webpack/lib/NormalModule.js:295:3)
    at NormalModule.build (./node_modules/webpack/lib/NormalModule.js:446:15)
    at Compilation.buildModule (./node_modules/webpack/lib/Compilation.js:739:10)
    at factory.create (./node_modules/webpack/lib/Compilation.js:981:14)
    at factory (./node_modules/webpack/lib/NormalModuleFactory.js:409:6)
    at hooks.afterResolve.callAsync (./node_modules/webpack/lib/NormalModuleFactory.js:155:13)
    at _fn0 (<anonymous>:14:1)
    at fileExistsWithCase (./node_modules/case-sensitive-paths-webpack-plugin/index.js:158:9)
    at that.fileExistsWithCase (./node_modules/case-sensitive-paths-webpack-plugin/index.js:113:7)
    at that.fileExistsWithCase (./node_modules/case-sensitive-paths-webpack-plugin/index.js:113:7)
    at that.fileExistsWithCase (./node_modules/case-sensitive-paths-webpack-plugin/index.js:113:7)
    at CaseSensitivePathsPlugin.fileExistsWithCase (./node_modules/case-sensitive-paths-webpack-plugin/index.js:83:5)
    at that.getFilenamesInDir (./node_modules/case-sensitive-paths-webpack-plugin/index.js:106:10)
    at CaseSensitivePathsPlugin.getFilenamesInDir (./node_modules/case-sensitive-paths-webpack-plugin/index.js:51:5)
    at CaseSensitivePathsPlugin.fileExistsWithCase (./node_modules/case-sensitive-paths-webpack-plugin/index.js:89:8)
    at that.getFilenamesInDir (./node_modules/case-sensitive-paths-webpack-plugin/index.js:106:10)
    at Array.fs.readdir (./node_modules/case-sensitive-paths-webpack-plugin/index.js:67:5)
    at Storage.finished (./node_modules/webpack/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:55:16)
    at provider (./node_modules/webpack/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:91:9)
    at fs.readdir (./node_modules/webpack/node_modules/enhanced-resolve/lib/NodeJsInputFileSystem.js:12:4)
    at go$readdir$cb (./node_modules/webpack/node_modules/graceful-fs/graceful-fs.js:187:14)
    at FSReqWrap.oncomplete (fs.js:141:20)

 @ ./bundle.js 49:0-26

filipkis avatar May 03 '20 18:05 filipkis

Yes, please add uglify-js to package.json

mbibko avatar May 15 '20 08:05 mbibko

👍I'll check this out this week and hopefully get something published.

fleck avatar Jun 08 '20 13:06 fleck