Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
394 views
in Technique[技术] by (71.8m points)

javascript - Bootstrap loader can't resolve "glyphicons-halflings-regular.eot"

I am trying to upgrade a legacy react app with webpack and react-bootstrap, after upgrading to latest packages, and while running yarn, I am getting below error

Here is my webpack config file

'use strict';
    var rootDir = __dirname;
    var path = require('path');
    var webpack = require('webpack');
    const MiniCssExtractPlugin = require('mini-css-extract-plugin');
    
    require('app-module-path').addPath(__dirname + '/src');
    
    module.exports = {
        mode: 'production',
        context: path.resolve(rootDir),
        entry:  {
            home: ['./src/pages/index/dependencies.js']
    
        },
        output: {
            path: path.resolve('public/static'),
            filename: '[name].js',
            publicPath: '/rct/static/'
        },
        resolve: {
            modules: [
                __dirname + '/public',
                'node_modules'
            ],
            alias: {
                 react: path.resolve(rootDir,'./node_modules/react/'),
                'react-dom': path.resolve(rootDir,'./node_modules/react-dom/')
            },
            extensions: ['.js', '.jsx', 'json'] // resolve file extentions so that we don't have to specify the extention for js and jsx files
        },
        module: {
            rules: [
                { test: /.jsx?$/, exclude: /(node_modules)/, use:[ 'react-hot-loader/webpack', 'babel-loader' ]},
                { test: /.css$/, use: ['style-loader', 'css-loader'] },
                { test: /.(png|jpg|woff|woff2|eot|ttf|otf)/, use: 'url-loader' },
                { test: /.svg(?v=d+.d+.d+)?$/, use: "url-loader?limit=10000&mimetype=image/svg+xml'", },
                {
                    test: /.scss$/,
                    exclude: /node_modules/,
                    use: [
                        'style-loader',
                        MiniCssExtractPlugin.loader,
                        'css-loader',
                        'sass-loader',
                        {
                            loader: 'sass-resources-loader',
                            options: {
                                resources: ['./src/pages/index/default.scss']
                            },
                        }
                    ]
                }
            ],
        },
        plugins: [
            new MiniCssExtractPlugin({filename: '[name].css'})
        ]
    };

Error, if you look closely the path is not correct as well '../bootstrap-sass/assets/stylesheets/bootstrap-sass/assets/fonts/bootstrap/glyphicons-halflings-regular.eot'

 ERROR in ./node_modules/bootstrap-loader/no-op.js (./node_modules/css-loader/dist/cjs.js!./node_modules/resolve-url-loader!./node_modules/sass-loader/dist/cjs.js?sourceMap!./node_modules/bootstrap-loader/lib/bootstrap.styles.loader.js?{"bootstrapVersion":3,"useCustomIconFontPath":false,"extractStyles":true,"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":["transition","alert","button","carousel","collapse","dropdown","modal","tooltip","popover","scrollspy","tab","affix"],"configFilePath":"/Users/user/code/app/node_modules/bootstrap-loader/.bootstraprc-3-default","bootstrapPath":"/Users/user/code/app/node_modules/bootstrap-sass","bootstrapRelPath":"../bootstrap-sass"}!./node_modules/bootstrap-loader/no-op.js)
    Module build failed (from ./node_modules/css-loader/dist/cjs.js):
    Error: Can't resolve '../bootstrap-sass/assets/stylesheets/bootstrap-sass/assets/fonts/bootstrap/glyphicons-halflings-regular.eot' in '/Users/user/code/app/node_modules/bootstrap-loader'
        at /Users/user/code/rctapp/node_modules/enhanced-resolve/lib/Resolver.js:209:21
        at /Users/user/code/rctapp/node_modules/enhanced-resolve/lib/Resolver.js:285:5
        at eval (eval at create (/Users/user/code/rctapp/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:13:1)
        at /Users/user/code/rctapp/node_modules/enhanced-resolve/lib/UnsafeCachePlugin.js:44:7
        at /Users/user/code/rctapp/node_modules/enhanced-resolve/lib/Resolver.js:285:5
        at eval (eval at create (/Users/user/code/rctapp/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:13:1)
        at /Users/user/code/rctapp/node_modules/enhanced-resolve/lib/Resolver.js:285:5
        at eval (eval at create (/Users/user/code/rctapp/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:25:1)
        at /Users/user/code/rctapp/node_modules/enhanced-resolve/lib/DescriptionFilePlugin.js:67:43
        at /Users/user/code/rctapp/node_modules/enhanced-resolve/lib/Resolver.js:285:5
        at eval (eval at create (/Users/user/code/rctapp/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:14:1)
        at /Users/user/code/rctapp/node_modules/enhanced-resolve/lib/Resolver.js:285:5
        at eval (eval at create (/Users/user/code/rctapp/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:25:1)
        at /Users/user/code/rctapp/node_modules/enhanced-resolve/lib/DescriptionFilePlugin.js:67:43
        at /Users/user/code/rctapp/node_modules/enhanced-resolve/lib/Resolver.js:285:5
        at eval (eval at create (/Users/user/code/rctapp/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:14:1)
        at /Users/user/code/rctapp/node_modules/enhanced-resolve/lib/Resolver.js:285:5
        at eval (eval at create (/Users/user/code/rctapp/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:13:1)
        at /Users/user/code/rctapp/node_modules/enhanced-resolve/lib/DirectoryExistsPlugin.js:27:15
        at /Users/user/code/rctapp/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:85:15
        at processTicksAndRejections (internal/process/task_queues.js:79:11)
     @ ./node_modules/bootstrap-loader/no-op.js (./node_modules/style-loader/dist/cjs.js!./node_modules/css-loader/dist/cjs.js!./node_modules/resolve-url-loader!./node_modules/sass-loader/dist/cjs.js?sourceMap!./node_modules/bootstrap-loader/lib/bootstrap.styles.loader.js?{"bootstrapVersion":3,"useCustomIconFontPath":false,"extractStyles":true,"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":["transition","alert","button","carousel","collapse","dropdown","modal","tooltip","popover","scrollspy","tab","affix"],"configFilePath":"/Users/user/code/rctapp/node_modules/bootstrap-loader/.bootstraprc-3-default","bootstrapPath":"/Users/user/code/rctapp/node_modules/bootstrap-sass","bootstrapRelPath":"../bootstrap-sass"}!./node_modules/bootstrap-loader/no-op.js) 2:26-1230
question from:https://stackoverflow.com/questions/65854206/bootstrap-loader-cant-resolve-glyphicons-halflings-regular-eot

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...