Webpack 2.7 is experiencing difficulty loading the blueprintjs core CSS

While attempting to utilize blueprintjs and importing its CSS, I believe I may have misconfigured my webpack setup. This resulted in the following error https://i.sstatic.net/eErly.png

Below is my webpack configuration:

const ExtractTextPlugin = require('extract-text-webpack-plugin');
var webpack = require("webpack");
var path = require("path");

module.exports={
    entry: './src/index.js',
    output:{
        path: __dirname + "/public",
        filename:'bundle.js',
        publicPath: "/public/"
    },
    devServer: {
        inline: true,
        contentBase: './public',
        port: 3000
    },
    module:{
        rules: [
            {
            test: /\.js$/,
            exclude: /(node_modules)/,
            loader: "babel-loader",
            query: {
                presets: ['es2015', 'react', 'stage-0'],

            }
        }, 
        {
             test: /\.s(a|c)ss$/, 
                loader: ExtractTextPlugin.extract({loader: ['css-loader', 'sass-loader', 'style-loader']})
              },
              {
                test: /\.css$/,
                use: [
                  {
                    loader: 'style-loader',
                  },
                  {
                    loader: 'css-loader',
                  },
                ],
              },
              {
                test: /\.(|gif||svg|woff|woff2|eot|ttf)(\?v=[0-9]\.[0-9]\.[0-9])?$/, 
                loader: 'file-loader', options: {name: '[name].[ext]'}
              },  {
                test: /\.(png|jpg|)$/,
                loader: 'url-loader?limit=200000'
              },
        ] 
    },
    plugins: [
        new ExtractTextPlugin("styles.css"),
      ]

}

The packages I am using are "webpack": "^2.7.0", "@blueprintjs/core": "^1.34.1" along with several loaders.

I attempted importing my CSS in two ways:

require('!css-loader!./index.css');

And also:

import styles from './index.css'

However, both methods yielded the same result. After spending additional time troubleshooting, I encountered this error:

https://i.sstatic.net/4EKdy.png At this point, I am uncertain about the issue with my webpack setup and how to resolve it. Any advice or suggestions would be greatly appreciated.

Answer №2

To resolve the webpack error shown in the screenshot, consider using the full path to blueprint.css within the NPM package. The issue arises from the css-loader attempting to load esm/index.js, a JavaScript file instead of the intended CSS file.

Solution: Update the import statement to

@import "~@blueprintjs/core/lib/css/blueprint.css";

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

What is the best method for implementing the material-ui lab - checkbox tag component in a different class component?

I have a Form component called Add.js and a functional component called CheckboxesTags.js. My goal is to retrieve the selected items from CheckboxesTags.js in Add.js so that I can send them along with other values using Axios. I tried adding <Checkboxes ...

Creating a React button animation with CSS vibes

When I click a button, I want a subtle sparkle to appear and disappear quickly, within half a second. I've thought about using a gif, but it requires a lot of manual artistic work to achieve the desired effect. Is there a way to utilize the Animatio ...

NextJs experiencing hydration issue due to a basic array.map operation

Having an odd hydration issue while working with NextJS. I could use some assistance figuring out what's causing it. I have an object that is being processed synchronously. When I stringify this object and render it, everything works fine without any ...

Unlock the secret: Using Javascript and Protractor to uncover the elusive "hidden" style attribute

My website has a search feature that displays a warning message when invalid data, such as special characters, is used in the search. Upon loading the page, the CSS initially loads like this: <div class="searchError" id="isearchError" style="display: ...

Using an icon font as a background in CSS attribute

I am struggling to replace a background image in CSS with an icon font instead of an icon image. I have been unable to accomplish this task. Here is the CSS property I am working with: .social-networks .twitter{background:url(../images/social/twitter.png) ...

What could be causing the circular reference error in this situation?

I've put together this snippet of code that is triggering an error when executed in a React / Next.js environment: const myArray = ["a","b","c"]; myArray.forEach((item, index, array) => { if(item === "b") { array[index] = <span>b</ ...

Hide the element once the CSS animation has finished

I have successfully implemented an animation using pure CSS that starts on load. However, I am facing an issue with both opacity and visibility as the div continues to take up space even when hidden. Question Is there a way to make the div disappear comp ...

Troubleshooting: Why isn't my Axios PUT request functioning properly?

My issue is that axios.put method isn't working, but axios.post works perfectly fine. Here's an example of a successful post request: let response = await axios.post(`${ROOT_URL}/urls/url/`, { post_id, password, content }, { heade ...

What could be causing the need to restart the server every time a style change is made?

I'm currently developing a NextJS application that utilizes PurgeCSS. It's quite frustrating because every time I tweak the classname of a component, I have to restart the server. Here is a snippet from my postcss.config.js: plugins: [ [ ...

Tips for maintaining the size of child elements within a parent container without affecting the font size in CSS

I have a basic navigation bar setup: <nav> <a href="#">Home</a> <a href="#">About</a> <a href="#">Register</a> </nav> Along with the CSS styling for the navigation and anchor tags: nav { background- ...

Set dimensions for the input submit border inside

Can anyone help me figure out how to prevent the border from being drawn inside of my submit button element? I have a specific width and height set for cross-browser consistency, but in Firefox 15 and IE7 the border gets applied to the inside of the elemen ...

Exploring Window Simulations using Sinon, Mocha, Enzyme, and React

Trying to simulate the window object for a component using only the specified libraries has been a challenge. Although I know it can typically be achieved with JSDom, the client prefers not to use it. My research led me to believe that simply running sino ...

What is the best way to incorporate vertical lines into a set of progress bars?

I want to create progress bars with vertical lines representing specific steps within the progression. While I can display progress bars, I am unsure how to incorporate these vertical lines. Does anyone have any suggestions or ideas on how to achieve this? ...

Discover the ideal method for utilizing floating divs that overlap

I'm currently working on developing a custom Wordpress theme using PHP, HTML, and CSS. One issue I'm facing is that my footer automatically moves down below the white content block whenever I add more text. Now, I am looking to incorporate an ad ...

Vertically align header 3 text with a specific height

Recently, I encountered an issue with a h3 <h3>someText<h3> This particular h3 has a height and features a background image h3 { height:30px; background-image:url(); background-reat: repeat-x; } I am currently facing a challenge where the t ...

Creating a React component library can be problematic when incorporating styled components, as they may

I've been working on publishing my React component library, but I encountered an error when installing and testing it in create-react-app. I experimented with various templates for the React component library such as Rinsejs and create-react-library, ...

Arranging divs on a webpage

Greetings! I have a CSS 101 question that is troubling me in terms of alignment. Can anyone offer some assistance? Additionally, I have a couple of inquiries: When creating HTML divs, what is the best approach - setting size constraints on the divs fro ...

Arranging Bootstrap divs vertically and then horizontally in mobile view

My website layout is relatively straightforward. It consists of a header at the top, a navigation bar with an image inside a column on the left, and the main content displayed on the right side. https://i.stack.imgur.com/yYzaG.png For mobile responsive vi ...

Enhancing state arrays using React Hooks

I have a form that includes radio inputs. Every time a user selects an option, I need to update the array storing the answers for the questions. If the user is answering the same question again, the old answer should be overridden. To achieve this function ...

What is the best approach to serve the index.html static file from the client-side in an ExpressJS server?

Front-end: I have a Webpack-generated dist/index.html file that serves the user. Back-end nodeJs server side: In addition to the front-end, I have a Node.js server set up to serve static files such as index.html from the server itself. app.use(express. ...