bootstrap-loader: bootstrap-loader fails when extractStyles is enabled (set to true)
All is well until I turn on extractStyles… Any ideas?
ERROR in ./~/bootstrap-loader/lib/bootstrap.loader.js?extractStyles!./~/bootstrap-loader/no-op.js
Module not found: Error: Can't resolve '[object Object]./lib/bootstrap.styles.loader.js?{"bootstrapVersion":4,"preBootstrapCustomizations":"/Users/andrerecinto/projects/mount-everest/scss/pre-customizations.scss","bootstrapCustomizations":"/Users/andrerecinto/projects/mount-everest/scss/customizations.scss","appStyles":"/Users/andrerecinto/projects/mount-everest/scss/styles.scss","useFlexbox":true,"extractStyles":true,"styleLoaders":["style-loader","css-loader","postcss-loader","sass-loader"],
"styles":["mixins","normalize","print","reboot","type","images","code","grid","tables","forms","buttons","transitions","dropdown","button-group","input-group","custom-forms","nav","navbar", "card","breadcrumb","pagination","jumbotron","alert","progress","media","list-group","responsive-embed","close","badge","modal","tooltip","popover","carousel","utilities"],
"scripts":["alert","button","carousel","collapse","dropdown","modal","popover","scrollspy","tab","tooltip","util"],
"configFilePath":"/Users/andrerecinto/projects/mount-everest/.bootstraprc","bootstrapPath":"/Users/andrerecinto/projects/mount-everest/node_modules/bootstrap","bootstrapRelPath":"../bootstrap"}' in '/Users/andrerecinto/projects/mount-everest/node_modules/bootstrap-loader'
@ ./~/bootstrap-loader/lib/bootstrap.loader.js?extractStyles!./~/bootstrap-loader/no-op.js 1:21-1417
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 3
- Comments: 29 (9 by maintainers)
Commits related to this issue
- bootstrap-loader issue : https://github.com/shakacode/bootstrap-loader/issues/238 — committed to gimdongwoo/react-redux-universal-hot-boilerplate by gimdongwoo 7 years ago
- Fix of the ExtractTextPlugin bug This is a quick fix to get compatibility with the latest `webpack` (2.2.1) and the latest `extract-text-webpack-plugin`. Should fix #238 — committed to ridem/bootstrap-loader by ridem 7 years ago
@t47io In case it temporarily helps someone, this is what you can do to get it to work:
"postinstall": "./fix-bootstrap-loader.sh"entry to yourpackage.json.fix-bootstrap-loader.shwith the following content:npm installnode_modules/bootstrap-loader/lib/utils/buildExtractStylesLoader.jsand make sure that the end has been properly editedThis fix is just the PR I just made.
This works with the latest
ExtractTextPlugin(2.0.0-rc.2 and 2.0.0-rc.3) and the latestbootstrap-loader(beta 20). AFAIK the webpack version has no influence over that bug.Hope this can be fixed soon,
This seems to have been cause by a change between
extract-text-webpack-pluginversions Beta 5 and RC 0The commit: https://github.com/webpack-contrib/extract-text-webpack-plugin/commit/74b86e0221096c682538472b455118179b7991a3
I switched back to Beta 5 and it works fine now.
@JulioC here it is, I didn’t attach it before, because it’s not a masterpiece of coding, but it works fine. @ridem’s sh script is more sofisticated: it creates a backup copy of the original file and check for npm existance. Anyway:
The package.json section:
And the fix-bootstrap-loader.js:
Hello,
Don’t know if it came from the same bug (the error output seems to be same), but my build output is not working (already test with extract-text-webpack-plugin@beta5, it was worse than this) :
EDIT: all is working with your fix script. !
@alecf this code will solve that problem
However, this seems to be a separate issue with Webpack 2, ExtractTextPlugin and production builds; and it is not an issue exclusively reserved for bootstrap-loader
I state this because I’m working on the same bug. There is a long thread here about the same error: https://github.com/webpack-contrib/extract-text-webpack-plugin/issues/250
The problem seems to be that ExtractTextPlugin is now always returning an array of objects, rather than an array of strings.
I think it used to return:
and now it returns
It seems like https://github.com/shakacode/bootstrap-loader/blob/master/src/utils/buildExtractStylesLoader.js could perhaps be adjusted to handle both arrays of strings and objects?