我正在尝试使用blueprintjs,当我导入其CSS时。我认为我在webpack配置中出错了所以我看到了这个错误
有我的webpack配置
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"),
]
}
我正在使用“webpack”:“^ 2.7.0”,“@ blueprintjs / core”:“^ 1.34.1”和许多装载程序
我试图像这样导入我的CSS
require('!css-loader!./index.css');
就像这样
import styles from './index.css'
结果是相同的
经过额外几个小时的工作后,我收到了这个错误
答案 0 :(得分:0)
您可以将您的webpack配置与Blueprint monorepo中的配置进行比较:https://github.com/palantir/blueprint/tree/develop/packages/webpack-build-scripts
尝试按照基本配置中的相同顺序应用加载器:java.lang.IllegalStateException: Failed to load ApplicationContext
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name '...repository.OrderRepository#0': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [...repository.OrderRepository]: Specified class is an interface
...
答案 1 :(得分:0)
尝试使用NPM包中blueprint.css
的完整路径。屏幕截图中的webpack错误清楚地显示了css-loader尝试加载esm/index.js
这个JS文件,当然它失败了。
尝试:@import "~@blueprintjs/core/lib/css/blueprint.css";