webpack报错no postcss config...
终端里运行的错误:
查了好多资料,最后找到解决办法,改为:
const webpack = require('webpack');
// const autoprefixer = require('autoprefixer');
// const values = require('postcss-modules-values');
module.exports = {
devtool: 'eval-source-map', entry: __dirname + "/app/main.js",
output: {
path: __dirname + "/public",
filename: "bundle.js"
}, module: {//在配置文件里添加JSON loader
loaders: [
{
test: /\.json$/,
loader: "json-loader"
},
{
test: /\.js$/,
exclude:/node_modules/,
loader:'babel-loader',
query:{
presets:['es2015','react']
}
},
{
test:/\.css$/,
use:[
{
loader: 'style-loader',
},
{
loader: 'css-loader',
options: {
importLoaders: 1,
}
},
{
loader:"postcss-loader",
options: { // 如果没有options这个选项将会报错 No PostCSS Config found
plugins: (loader) => [
require('autoprefixer')(), //CSS浏览器兼容
]
}
}
]
// loader:'style-loader!css-loader?modules!postcss-loader'
}
]
}, plugins: [
new webpack.LoaderOptionsPlugin({
options:{
// postcss: function () {
// return [
// require("autoprefixer")({
// browsers: ['last 10 Chrome versions', 'last 5 Firefox versions', 'Safari >= 6', 'ie > 8']
// })
// ]
// },
// plugins: (loader) => [
// require('autoprefixer')(), //CSS浏览器兼容
// ],
devServer: {
contentBase: "./public",
colors: true,
historyApiFallback: true,
inline: true
}
}
})
]
}
但是,这里?modules不起作用了,后面再看看怎么书写
找到解决办法了
{
loader: 'css-loader',
options: {
importLoaders: 1,
modules:true
}
},
把modules加在这里,妥妥的执行
webpack报错no postcss config...的更多相关文章
- webpack 报错 No PostCSS Config found 解决方案。
webpack 报错 No PostCSS Config found 这个问题我在百度上找了好久,也没有找到解决方案,最后没有办法只能自己去啃官方文档,本案例在本人的webpack 学习感悟中已经写 ...
- npm run build报错 No PostCSS Config found in
在项目根目录新建postcss.config.js文件,并对postcss进行配置: module.exports = { plugins: [ require('autoprefixer')//自动 ...
- webpack编译时No PostCSS Config的解决方法
1. { loader:"postcss-loader", options: { // 如果没有options这个选项将会报错 No PostCSS Config found pl ...
- webpack报错:Module build failed (from ./node_modules/babel-loader/lib/index.js): Error: Cannot find module 'babel-preset-env' from '...' - Did you mean "@babel/env"?
webpack报错:Module build failed (from ./node_modules/babel-loader/lib/index.js): Error: Cannot find mo ...
- Git报错 bad numeric config value '100000' for 'pack.windowmemory': out of range
Git报错 bad numeric config value '10240M' for 'pack.windowmemory': out of range $ git config --edit -- ...
- Vue+webpack报错: listen EADDRINUSE: address already in use :::8080
如果本地运行多个vue+webpack项目会报错:listen EADDRINUSE: address already in use :::8080: 提示含义:地址端口已经被占用 注:8080指的是 ...
- webpack One CLI for webpack must be installed. These are recommended choices, delivered as separate(webpack报错)
用webpack 打包项目的时候:webpack js.js bundle.js 报错. 最近在安装好webpack后,使用时,提示 One CLI for webpack must be insta ...
- webpack报错Cannot read property 'presetToOptions' of undefined
在学习react全家桶时,webpack首先报错,报错内容如下,最后我是因为没有全局安装webpack导致的报错,使用npm install webpack -g安装解决了这个问题.
- react脚手架抽离webpack报错解决
我们在写react项目的时候,可能原有的webpack配置不满足我们的需求,需要自己去配置,可是你在创建脚手架的时候并不能在外部找到webpack文件,脚手架的webpack文件在node_modul ...
随机推荐
- Linux下 sleep函数的注意事项
1. 休眠sleep(unsigned int)为线程内操作 所以如果不同线程,信号量SIGALRM是不能中断sleep(): 编写程序进行测试 //timercreate_demo.cpp #i ...
- node定时任务——node-schedule模块使用说明
在实际开发项目中,会遇到很多定时任务的工作.比如:定时导出某些数据.定时发送消息或邮件给用户.定时备份什么类型的文件等等. 一般可以写个定时器,来完成相应的需求,在node.js中自已实现也非常容易, ...
- Apache重启报警,不存在虚拟主机目录(httpd.conf打开了一些扩展)
Apache重启时报警: AH00112: Warning: DocumentRoot [/usr/local/apache/docs/dummy-host.example.com] does not ...
- 带密匙的php加密解密代码
php加密解密示例,代码如下: <?php $id = "http://www.jbxue.com"; $token = encrypt($id, 'E', 'jbxue') ...
- Redis 面试题(持续更新)
前言 看了一圈,发现Redis的面试题主要问的是如下几块: 原理 用处(缓存/队列 包括Pub.Sub/计数器/排行榜等) 基本操作与数据类型 消息队列 且与其它消息队列的区别 主从备份 宕机如何处理 ...
- GDB和WinDbg中调用函数
GDB: 特别简单,直接写调用式子即可,如下图的p word.c_str(),其中word的类型是std::string WinDbg:目前都说是.call命令,说实话我宁愿不用...见: http: ...
- 常见编码和编码头BOM
ANSI(American National Standards Institute,美国国家标准学会)ANSI编码标准是指所有从基本ASCII码基础上发展起来的编码标准,比如扩展的ASCII码(12 ...
- FreeRTOS 系统时钟节拍和时间管理
以下转载自安富莱电子: http://forum.armfly.com/forum.php FreeRTOS 的时钟节拍任何操作系统都需要提供一个时钟节拍,以供系统处理诸如延时. 超时等与时间相关的事 ...
- CodeForces 1A Theatre Square
A - Theatre Square Time Limit:2000MS Memory Limit:65536KB 64bit IO Format:%I64d & %I64u ...
- js监听 window.open 关闭事件
转载自:http://blog.csdn.net/hanshileiai/article/details/41346729 首先创建一个新的对象,这将打开一个弹出这样的: var winObj = w ...