I'm trying to use blueprintjs so I followed the tutorial with this line:
main.sass
@import "~@blueprintjs/core";
However my webpack-dev-server gives me this error log:
ERROR in ./node_modules/css-loader?{"minimize":false}!./node_modules/postcss-loader/lib?{"sourceMap":true}!./node_modules/resolve-url-loader!./node_modules/sass-loader/lib/loader.js?{"sourceMap":true}!./app/javascript/packs/main.sass
Module build failed:
*/
^
Invalid CSS after " */": expected 1 selector or at-rule, was '"use strict";'
in <redacted>/node_modules/@blueprintjs/core/dist/index.js (line 6, column 4)
webpack: Failed to compile.
So I'm confused why it's trying to parse an index.js file as sass into css!
Looking at ./config/webpack/loaders/sass.js
, which I haven't touched:
const ExtractTextPlugin = require('extract-text-webpack-plugin')
const { env } = require('../configuration.js')
module.exports = {
test: /\.(scss|sass|css)$/i,
use: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: [
{ loader: 'css-loader', options: { minimize: env.NODE_ENV === 'production' } },
{ loader: 'postcss-loader', options: { sourceMap: true } },
'resolve-url-loader',
{ loader: 'sass-loader', options: { sourceMap: true } }
]
})
}
I only see it trying to read sass, scss and css files. Any ideas what I'm missing or should check?
You are receiving an error because in you
main.sass
file you are importing a JS module.~@blueprintjs/core
resolves tonode_modules/@blueprintjs/core/dist/index.js
and thus you are getting JS mixed in the process.You should see what files the
blueprintjs/core/dist
folder contains and only importsass/scss/css
files to make your build.you just need to add the code below on your App.css file
@import "~@blueprintjs/core/dist/blueprint.css";