我正在将样式加载器与webpack和react框架一起使用。当我在终端中运行webpack时,Module not found: Error: Cannot resolve module 'style-loader'
尽管我已正确指定了文件路径,但我仍获取import.js文件。
import '../css/style.css';
import React from 'react';
import ReactDOM from 'react-dom';
import jQuery from 'jquery';
import TopicsList from '../components/topic-list.jsx';
import Layout from '../components/layout.jsx';
webpack.config.js:
var webpack = require('webpack');
var path = require('path');
var BUILD_DIR = path.resolve(__dirname, 'build');
var APP_DIR = path.resolve(__dirname, 'build');
module.exports = {
entry: [
// Set up an ES6-ish environment
'babel-polyfill',
// Add your application's scripts below
APP_DIR + '/import.js'
],
output: {
path: BUILD_DIR,
filename: 'bundle.js'
},
module: {
loaders: [
{
test: /\.jsx?$/,
loader: 'babel',
exclude: /node_modules/,
query: {
plugins: ['transform-runtime'],
presets: ['es2015', 'stage-0', 'react']
}
},
{ test: /\.css$/, loader: "style-loader!css-loader" }
],
resolve: {
extensions: ['', '.js', '.jsx', '.css']
}
}
};
尝试在下面运行脚本:
npm install style-loader --save
修改webpack配置,在中添加modulesDirectories
字段resolve
。
resolve: {
extensions: ['', '.js', '.jsx', '.css'],
modulesDirectories: [
'node_modules'
]
}
我正在使用css加载程序,出现以下错误: 错误/src/pages/home/index。未找到js 模块:错误:无法解析“/Users/jian/Documents/sina/webpack barbarrian test”中的“css加载程序” @/src/pages/home/index。js 2:0-20 @multi/webpack barbarian/node_模块/webpack开发
问题内容: 我正在使用Babel和Webpack开发一个React应用,我想使用npm中的软件包。我已经安装了该软件包并将其保存为项目的依赖项。运行npm start后,出现此错误: ./~/file-exists/index.js中的错误找不到 模块:错误:无法在C:\ GitHub \ CryptoPrices \ node_modules \ file-exists @ ./~/file-e
我正在使用Redux尝试我的第一个react-native应用程序,并在设备上运行应用程序时得到以下错误消息, “UnableToResolveError:无法从C:\project\testing\index.android.js解析模块react-redux/native:模块映射或以下目录中不存在模块:C:\project\testing\node_modules\react-redux”
尝试在android上构建带有react-navigation的react-native v0.61.5应用程序时遇到此错误。iOS运行良好,不知道为什么我会得到这个index.android文件错误,因为我认为react-native将索引文件合并到singular < code > index . js 作为入口点。 这是全部错误: 加载依赖图,完成。错误:无法解析模块<代码>。``中的/in
当我执行npm运行构建时,我得到以下错误 找不到./src/assets/scss/theme.scss(./node_modules/css-loader/dist/cjs.js!./node_modules/resolve-url-loader!./node_modules/sass-loader/dist/cjs.js!./src/assets/scss/theme.scss)模块:错误:无
我正在用JDK11和Eclipse 2020-06开发一个RCP应用程序。我有一个基于功能的产品文件。当我发布产品时,我得到了如下错误。我听说JDK 11不包含JAXB。这个错误与此有关吗?我正在努力寻找解决办法。。谢谢你的帮助。谢谢 !ENTRYorg.eclipse.mylyn.commons.notifications.feed4 0 2021-02-08 18:15:45.088!消息框架