shakacode/bootstrap-loader

`global.__DEBUG__` set in `bootstrap.loader.js` but not `bootstrap.scripts.loader`

Closed this issue · 6 comments

vjpr commented

What could be causing this? Does webpack run the loader in another Node.js context or something like that?

This prevents log messages working in the bootstrap.styles.loader.js.

A workaround would be to re-read the config file in bootstrap.styles.loader.js and use the option for the debug value.

vjpr commented

The query string for bootstrap.styles.loader.js is different from what bootstrap-loader is requiring as well. Maybe its related...

Notice how bootstrapRelPath is different. This is causing me a lot of issues.

bootstrap.loader.js:

[bootstrap-loader]:  Requiring:
 module.exports.css = require ("style-loader!css-loader!resolve-url-loader!sass-loader?sourceMap!./lib/bootstrap.styles.loader.js?{\"bootstrapVersion\":3,\"loglevel\":\"debug\",\"preBootstrapCustomizations\":\"/Users/Vaughan/zzz/modules/bootstrap-config/pre-customizations.scss\",\"bootstrapCustomizations\":\"/Users/Vaughan/zzz/modules/bootstrap-config/customizations.scss\",\"extractStyles\":false,\"styleLoaders\":[\"style-loader\",\"css-loader\",\"sass-loader\"],\"styles\":[\"mixins\",\"normalize\",\"print\",\"glyphicons\",\"scaffolding\",\"type\",\"code\",\"grid\",\"tables\",\"forms\",\"buttons\",\"component-animations\",\"dropdowns\",\"button-groups\",\"input-groups\",\"navs\",\"navbar\",\"breadcrumbs\",\"pagination\",\"pager\",\"labels\",\"badges\",\"jumbotron\",\"thumbnails\",\"alerts\",\"progress-bars\",\"media\",\"list-group\",\"panels\",\"wells\",\"responsive-embed\",\"close\",\"modals\",\"tooltip\",\"popovers\",\"carousel\",\"utilities\",\"responsive-utilities\",\"transitions\",\"badge\"],\"scripts\":false,\"configFilePath\":\"/Users/Vaughan/zzz/.bootstraprc\",\"bootstrapPath\":\"/Users/Vaughan/dev-live/webpackerator/node_modules/bootstrap-sass\",\"bootstrapRelPath\":\"../../../../../bootstrap-sass\"}!../../../../source-map-loader/0.1.5/node_modules/source-map-loader/index.js!/Users/Vaughan/dev-live/webpackerator/node_modules/.registry.npmjs.org/bootstrap-loader/2.0.0-beta.20/node_modules/bootstrap-loader/no-op.js");

-> \"bootstrapRelPath\":\"../../../../../bootstrap-sass\"

bootstrap.styles.loader.js

this.query:

?{"bootstrapVersion":3,"loglevel":"debug","preBootstrapCustomizations":"/Users/Vaughan/zzz/modules/bootstrap-config/pre-customizations.scss","bootstrapCustomizations":"/Users/Vaughan/zzz/modules/bootstrap-config/customizations.scss","extractStyles":false,"styleLoaders":["style-loader","css-loader","sass-loader"],"styles":["mixins","normalize","print","glyphicons","scaffolding","type","code","grid","tables","forms","buttons","component-animations","dropdowns","button-groups","input-groups","navs","navbar","breadcrumbs","pagination","pager","labels","badges","jumbotron","thumbnails","alerts","progress-bars","media","list-group","panels","wells","responsive-embed","close","modals","tooltip","popovers","carousel","utilities","responsive-utilities","transitions","badge"],"scripts":false,"configFilePath":"/Users/Vaughan/zzz/.bootstraprc","bootstrapPath":"/Users/Vaughan/dev-live/webpackerator/node_modules/bootstrap-sass","bootstrapRelPath":"../bootstrap-sass"}

-> "bootstrapRelPath":"../bootstrap-sass"


Maybe some loader plugin in the Webpack config is modifying it?


Okay when I check this:

this._module

...
     request: '/Users/Vaughan/dev-live/webpackerator/node_modules/.registry.npmjs.org/css-loader/0.26.1/node_modules/css-loader/index.js!/Users/Vaughan/dev-live/webpackerator/node_modules/.registry.npmjs.org/resolve-url-loader/1.6.1/node_modules/resolve-url-loader/index.js!/Users/Vaughan/dev-live/webpackerator/node_modules/.registry.npmjs.org/sass-loader/5.0.1/node_modules/sass-loader/lib/loader.js?sourceMap!/Users/Vaughan/dev-live/webpackerator/node_modules/.registry.npmjs.org/bootstrap-loader/2.0.0-beta.20/node_modules/bootstrap-loader/lib/bootstrap.styles.loader.js?{"bootstrapVersion":3,"loglevel":"debug","preBootstrapCustomizations":"/Users/Vaughan/dev-xxx/xxx-app/modules/bootstrap-config/pre-customizations.scss","bootstrapCustomizations":"/Users/Vaughan/dev-xxx/xxx-app/modules/bootstrap-config/customizations.scss","extractStyles":false,"styleLoaders":["style-loader","css-loader","sass-loader"],"styles":["mixins","normalize","print","glyphicons","scaffolding","type","code","grid","tables","forms","buttons","component-animations","dropdowns","button-groups","input-groups","navs","navbar","breadcrumbs","pagination","pager","labels","badges","jumbotron","thumbnails","alerts","progress-bars","media","list-group","panels","wells","responsive-embed","close","modals","tooltip","popovers","carousel","utilities","responsive-utilities"],"scripts":false,"configFilePath":"/Users/Vaughan/dev-xxx/xxx-app/.bootstraprc","bootstrapPath":"/Users/Vaughan/dev-live/webpackerator/node_modules/bootstrap-sass","bootstrapRelPath":"../bootstrap-sass"}!/Users/Vaughan/dev-live/webpackerator/node_modules/.registry.npmjs.org/source-map-loader/0.1.5/node_modules/source-map-loader/index.js!/Users/Vaughan/dev-live/webpackerator/node_modules/.registry.npmjs.org/source-map-loader/0.1.5/node_modules/source-map-loader/index.js!/Users/Vaughan/dev-live/webpackerator/node_modules/.registry.npmjs.org/bootstrap-loader/2.0.0-beta.20/node_modules/bootstrap-loader/no-op.js',
     userRequest: '/Users/Vaughan/dev-live/webpackerator/node_modules/.registry.npmjs.org/css-loader/0.26.1/node_modules/css-loader/index.js!/Users/Vaughan/dev-live/webpackerator/node_modules/.registry.npmjs.org/resolve-url-loader/1.6.1/node_modules/resolve-url-loader/index.js!/Users/Vaughan/dev-live/webpackerator/node_modules/.registry.npmjs.org/sass-loader/5.0.1/node_modules/sass-loader/lib/loader.js?sourceMap!/Users/Vaughan/dev-live/webpackerator/node_modules/.registry.npmjs.org/bootstrap-loader/2.0.0-beta.20/node_modules/bootstrap-loader/lib/bootstrap.styles.loader.js?{"bootstrapVersion":3,"loglevel":"debug","preBootstrapCustomizations":"/Users/Vaughan/dev-xxx/xxx-app/modules/bootstrap-config/pre-customizations.scss","bootstrapCustomizations":"/Users/Vaughan/dev-xxx/xxx-app/modules/bootstrap-config/customizations.scss","extractStyles":false,"styleLoaders":["style-loader","css-loader","sass-loader"],"styles":["mixins","normalize","print","glyphicons","scaffolding","type","code","grid","tables","forms","buttons","component-animations","dropdowns","button-groups","input-groups","navs","navbar","breadcrumbs","pagination","pager","labels","badges","jumbotron","thumbnails","alerts","progress-bars","media","list-group","panels","wells","responsive-embed","close","modals","tooltip","popovers","carousel","utilities","responsive-utilities"],"scripts":false,"configFilePath":"/Users/Vaughan/dev-xxx/xxx-app/.bootstraprc","bootstrapPath":"/Users/Vaughan/dev-live/webpackerator/node_modules/bootstrap-sass","bootstrapRelPath":"../bootstrap-sass"}!/Users/Vaughan/dev-live/webpackerator/node_modules/.registry.npmjs.org/source-map-loader/0.1.5/node_modules/source-map-loader/index.js!/Users/Vaughan/dev-live/webpackerator/node_modules/.registry.npmjs.org/source-map-loader/0.1.5/node_modules/source-map-loader/index.js!/Users/Vaughan/dev-live/webpackerator/node_modules/.registry.npmjs.org/bootstrap-loader/2.0.0-beta.20/node_modules/bootstrap-loader/no-op.js',
     rawRequest: '!!./../../../../css-loader/0.26.1/node_modules/css-loader/index.js!./../../../../resolve-url-loader/1.6.1/node_modules/resolve-url-loader/index.js!./../../../../sass-loader/5.0.1/node_modules/sass-loader/lib/loader.js?sourceMap!./lib/bootstrap.styles.loader.js?{"bootstrapVersion":3,"loglevel":"debug","preBootstrapCustomizations":"/Users/Vaughan/dev-xxx/xxx-app/modules/bootstrap-config/pre-customizations.scss","bootstrapCustomizations":"/Users/Vaughan/dev-xxx/xxx-app/modules/bootstrap-config/customizations.scss","extractStyles":false,"styleLoaders":["style-loader","css-loader","sass-loader"],"styles":["mixins","normalize","print","glyphicons","scaffolding","type","code","grid","tables","forms","buttons","component-animations","dropdowns","button-groups","input-groups","navs","navbar","breadcrumbs","pagination","pager","labels","badges","jumbotron","thumbnails","alerts","progress-bars","media","list-group","panels","wells","responsive-embed","close","modals","tooltip","popovers","carousel","utilities","responsive-utilities"],"scripts":false,"configFilePath":"/Users/Vaughan/dev-xxx/xxx-app/.bootstraprc","bootstrapPath":"/Users/Vaughan/dev-live/webpackerator/node_modules/bootstrap-sass","bootstrapRelPath":"../bootstrap-sass"}!./../../../../source-map-loader/0.1.5/node_modules/source-map-loader/index.js!./../../../../source-map-loader/0.1.5/node_modules/source-map-loader/index.js!./no-op.js',
...

this._module.issuer

request: '/Users/Vaughan/dev-live/webpackerator/node_modules/.registry.npmjs.org/style-loader/0.13.1/node_modules/style-loader/index.js!/Users/Vaughan/dev-live/webpackerator/node_modules/.registry.npmjs.org/css-loader/0.26.1/node_modules/css-loader/index.js!/Users/Vaughan/dev-live/webpackerator/node_modules/.registry.npmjs.org/resolve-url-loader/1.6.1/node_modules/resolve-url-loader/index.js!/Users/Vaughan/dev-live/webpackerator/node_modules/.registry.npmjs.org/sass-loader/5.0.1/node_modules/sass-loader/lib/loader.js?sourceMap!/Users/Vaughan/dev-live/webpackerator/node_modules/.registry.npmjs.org/bootstrap-loader/2.0.0-beta.20/node_modules/bootstrap-loader/lib/bootstrap.styles.loader.js?{"bootstrapVersion":3,"loglevel":"debug","preBootstrapCustomizations":"/Users/Vaughan/dev-xxx/xxx-app/modules/bootstrap-config/pre-customizations.scss","bootstrapCustomizations":"/Users/Vaughan/dev-xxx/xxx-app/modules/bootstrap-config/customizations.scss","extractStyles":false,"styleLoaders":["style-loader","css-loader","sass-loader"],"styles":["mixins","normalize","print","glyphicons","scaffolding","type","code","grid","tables","forms","buttons","component-animations","dropdowns","button-groups","input-groups","navs","navbar","breadcrumbs","pagination","pager","labels","badges","jumbotron","thumbnails","alerts","progress-bars","media","list-group","panels","wells","responsive-embed","close","modals","tooltip","popovers","carousel","utilities","responsive-utilities"],"scripts":false,"configFilePath":"/Users/Vaughan/dev-xxx/xxx-app/.bootstraprc","bootstrapPath":"/Users/Vaughan/dev-live/webpackerator/node_modules/bootstrap-sass","bootstrapRelPath":"../../../../../bootstrap-sass"}!/Users/Vaughan/dev-live/webpackerator/node_modules/.registry.npmjs.org/source-map-loader/0.1.5/node_modules/source-map-loader/index.js!/Users/Vaughan/dev-live/webpackerator/node_modules/.registry.npmjs.org/source-map-loader/0.1.5/node_modules/source-map-loader/index.js!/Users/Vaughan/dev-live/webpackerator/node_modules/.registry.npmjs.org/bootstrap-loader/2.0.0-beta.20/node_modules/bootstrap-loader/no-op.js',
        userRequest: '/Users/Vaughan/dev-live/webpackerator/node_modules/.registry.npmjs.org/style-loader/0.13.1/node_modules/style-loader/index.js!/Users/Vaughan/dev-live/webpackerator/node_modules/.registry.npmjs.org/css-loader/0.26.1/node_modules/css-loader/index.js!/Users/Vaughan/dev-live/webpackerator/node_modules/.registry.npmjs.org/resolve-url-loader/1.6.1/node_modules/resolve-url-loader/index.js!/Users/Vaughan/dev-live/webpackerator/node_modules/.registry.npmjs.org/sass-loader/5.0.1/node_modules/sass-loader/lib/loader.js?sourceMap!/Users/Vaughan/dev-live/webpackerator/node_modules/.registry.npmjs.org/bootstrap-loader/2.0.0-beta.20/node_modules/bootstrap-loader/lib/bootstrap.styles.loader.js?{"bootstrapVersion":3,"loglevel":"debug","preBootstrapCustomizations":"/Users/Vaughan/dev-xxx/xxx-app/modules/bootstrap-config/pre-customizations.scss","bootstrapCustomizations":"/Users/Vaughan/dev-xxx/xxx-app/modules/bootstrap-config/customizations.scss","extractStyles":false,"styleLoaders":["style-loader","css-loader","sass-loader"],"styles":["mixins","normalize","print","glyphicons","scaffolding","type","code","grid","tables","forms","buttons","component-animations","dropdowns","button-groups","input-groups","navs","navbar","breadcrumbs","pagination","pager","labels","badges","jumbotron","thumbnails","alerts","progress-bars","media","list-group","panels","wells","responsive-embed","close","modals","tooltip","popovers","carousel","utilities","responsive-utilities"],"scripts":false,"configFilePath":"/Users/Vaughan/dev-xxx/xxx-app/.bootstraprc","bootstrapPath":"/Users/Vaughan/dev-live/webpackerator/node_modules/bootstrap-sass","bootstrapRelPath":"../../../../../bootstrap-sass"}!/Users/Vaughan/dev-live/webpackerator/node_modules/.registry.npmjs.org/source-map-loader/0.1.5/node_modules/source-map-loader/index.js!/Users/Vaughan/dev-live/webpackerator/node_modules/.registry.npmjs.org/bootstrap-loader/2.0.0-beta.20/node_modules/bootstrap-loader/no-op.js',
        rawRequest: 'style-loader!css-loader!resolve-url-loader!sass-loader?sourceMap!./lib/bootstrap.styles.loader.js?{"bootstrapVersion":3,"loglevel":"debug","preBootstrapCustomizations":"/Users/Vaughan/dev-xxx/xxx-app/modules/bootstrap-config/pre-customizations.scss","bootstrapCustomizations":"/Users/Vaughan/dev-xxx/xxx-app/modules/bootstrap-config/customizations.scss","extractStyles":false,"styleLoaders":["style-loader","css-loader","sass-loader"],"styles":["mixins","normalize","print","glyphicons","scaffolding","type","code","grid","tables","forms","buttons","component-animations","dropdowns","button-groups","input-groups","navs","navbar","breadcrumbs","pagination","pager","labels","badges","jumbotron","thumbnails","alerts","progress-bars","media","list-group","panels","wells","responsive-embed","close","modals","tooltip","popovers","carousel","utilities","responsive-utilities"],"scripts":false,"configFilePath":"/Users/Vaughan/dev-xxx/xxx-app/.bootstraprc","bootstrapPath":"/Users/Vaughan/dev-live/webpackerator/node_modules/bootstrap-sass","bootstrapRelPath":"../../../../../bootstrap-sass"}!../../../../source-map-loader/0.1.5/node_modules/source-map-loader/index.js!/Users/Vaughan/dev-live/webpackerator/node_modules/.registry.npmjs.org/bootstrap-loader/2.0.0-beta.20/node_modules/bootstrap-loader/no-op.js',

So it appears bootstrap.loader.js is causing bootstrap.styles.loader.js to run twice with different configs. Maybe I am running two bootstrap.loader.js files? Maybe bootstrap.loader.js is calling itself?

The only difference between each run is that bootstrapRelPath and there is a css-loader attached to the one with the broken bootstrapRelPath.

vjpr commented

So when I use disableResolveUrlLoader: true in .bootstraprc the debug messages show correctly. The resolve-url-loader is doing something screwy win webpack@2.

vjpr commented

Okay, so removing the style-loader from .bootstraprc fixed it.

Not sure exactly what was happening, but I think one of the loaders must have been returning a modified require(...bootstrap.loader.js?{...}) which was being run by a latter one...

@vjpr Not really sure if this is a bug, suggestion, etc...

Can we close this issue?

vjpr commented

@justin808 Its either a bug, or something in my config. bootstrap.style.loader.js is running with an incorrect bootstrapRelPath. What could be causing this?

I can see it being passed ../../../../bootstrap-sass, but then bootstrap.style.loader.js's this.query is ../bootstrap-sass. Something is modifying it...but what?

I've be on it for about 3 hours, I'm finding it really difficult to track down the issue.

Here is the error:

ERROR in /Users/Vaughan/dev-live/webpackerator/~/.registry.npmjs.org/css-loader/0.26.1/~/css-loader!/Users/Vaughan/dev-live/webpackerator/~/.registry.npmjs.org/sass-loader/5.0.1/~/sass-loader/lib/loader.js!/Users/Vaughan/dev-live/webpackerator/~/.registry.npmjs.org/bootstrap-loader/2.0.0-beta.20/~/bootstrap-loader/lib/bootstrap.styles.loader.js?{"bootstrapVersion":3,"loglevel":"debug","preBootstrapCustomizations":"/Users/Vaughan/dev-xxx/xxx-app/modules/bootstrap-config/pre-customizations.scss","bootstrapCustomizations":"/Users/Vaughan/dev-xxx/xxx-app/modules/bootstrap-config/customizations.scss","disableSassSourceMap":true,"disableResolveUrlLoader":true,"extractStyles":false,"styleLoaders":["style-loader","css-loader","sass-loader"],"styles":["mixins","normalize","print","glyphicons","scaffolding","type","code","grid","tables","forms","buttons","component-animations","dropdowns","button-groups","input-groups","navs","navbar","breadcrumbs","pagination","pager","labels","badges","jumbotron","thumbnails","alerts","progress-bars","media","list-group","panels","wells","responsive-embed","close","modals","tooltip","popovers","carousel","utilities","responsive-utilities"],"scripts":false,"configFilePath":"/Users/Vaughan/dev-xxx/xxx-app/.bootstraprc","bootstrapPath":"/Users/Vaughan/dev-live/webpackerator/~/bootstrap-sass","bootstrapRelPath":"../bootstrap-sass"}!/Users/Vaughan/dev-live/webpackerator/~/.registry.npmjs.org/bootstrap-loader/2.0.0-beta.20/~/bootstrap-loader/no-op.js
Module build failed:
module.exports = {};
^
      File to import not found or unreadable: ../bootstrap-sass/assets/stylesheets/bootstrap/_mixins.
Parent style sheet: stdin
      in /Users/Vaughan/dev-live/webpackerator/node_modules/.registry.npmjs.org/bootstrap-loader/2.0.0-beta.20/node_modules/bootstrap-loader/no-op.js (line 1, column 1)
Error:
module.exports = {};
^
      File to import not found or unreadable: ../bootstrap-sass/assets/stylesheets/bootstrap/_mixins.
Parent style sheet: stdin
      in /Users/Vaughan/dev-live/webpackerator/node_modules/.registry.npmjs.org/bootstrap-loader/2.0.0-beta.20/node_modules/bootstrap-loader/no-op.js (line 1, column 1)
    at options.error (/Users/Vaughan/dev-live/webpackerator/node_modules/.registry.npmjs.org/node-sass/4.5.0/node_modules/node-sass/lib/index.js:291:26)
 @ /Users/Vaughan/dev-live/webpackerator/~/.registry.npmjs.org/style-loader/0.13.1/~/style-loader!/Users/Vaughan/dev-live/webpackerator/~/.registry.npmjs.org/css-loader/0.26.1/~/css-loader!/Users/Vaughan/dev-live/webpackerator/~/.registry.npmjs.org/sass-loader/5.0.1/~/sass-loader/lib/loader.js!/Users/Vaughan/dev-live/webpackerator/~/.registry.npmjs.org/bootstrap-loader/2.0.0-beta.20/~/bootstrap-loader/lib/bootstrap.styles.loader.js?{"bootstrapVersion":3,"loglevel":"debug","preBootstrapCustomizations":"/Users/Vaughan/dev-xxx/xxx-app/modules/bootstrap-config/pre-customizations.scss","bootstrapCustomizations":"/Users/Vaughan/dev-xxx/xxx-app/modules/bootstrap-config/customizations.scss","disableSassSourceMap":true,"disableResolveUrlLoader":true,"extractStyles":false,"styleLoaders":["style-loader","css-loader","sass-loader"],"styles":["mixins","normalize","print","glyphicons","scaffolding","type","code","grid","tables","forms","buttons","component-animations","dropdowns","button-groups","input-groups","navs","navbar","breadcrumbs","pagination","pager","labels","badges","jumbotron","thumbnails","alerts","progress-bars","media","list-group","panels","wells","responsive-embed","close","modals","tooltip","popovers","carousel","utilities","responsive-utilities"],"scripts":false,"configFilePath":"/Users/Vaughan/dev-xxx/xxx-app/.bootstraprc","bootstrapPath":"/Users/Vaughan/dev-live/webpackerator/~/bootstrap-sass","bootstrapRelPath":"../../../../../bootstrap-sass"}!/Users/Vaughan/dev-live/webpackerator/~/.registry.npmjs.org/bootstrap-loader/2.0.0-beta.20/~/bootstrap-loader/no-op.js 4:14-1399 13:2-17:4 14:20-1405
 @ /Users/Vaughan/dev-live/webpackerator/~/.registry.npmjs.org/bootstrap-loader/2.0.0-beta.20/~/bootstrap-loader/lib/bootstrap.loader.js?configFilePath=/Users/Vaughan/dev-xxx/xxx-app/.bootstraprc!/Users/Vaughan/dev-live/webpackerator/~/.registry.npmjs.org/bootstrap-loader/2.0.0-beta.20/~/bootstrap-loader/no-op.js
 @ dll vendor

If you look at the top line, you can see that bootstrapRelPath is ../boostrap-sass, but on the line lower down its ../../../../../bootstrap-sass which is what its suppose to be.

vjpr commented

Found the bug! It is an issue in the style-loader caused by loaderUtils.stringifyRequest.

webpack/loader-utils#54

This bug will occur when using a custom config file location when using webpack/loader-utils <=0.2.16 (waiting to be patched).