终端里运行的错误:

查了好多资料,最后找到解决办法,改为:

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...的更多相关文章

  1. webpack 报错 No PostCSS Config found 解决方案。

    webpack 报错 No PostCSS Config found  这个问题我在百度上找了好久,也没有找到解决方案,最后没有办法只能自己去啃官方文档,本案例在本人的webpack 学习感悟中已经写 ...

  2. npm run build报错 No PostCSS Config found in

    在项目根目录新建postcss.config.js文件,并对postcss进行配置: module.exports = { plugins: [ require('autoprefixer')//自动 ...

  3. webpack编译时No PostCSS Config的解决方法

    1. { loader:"postcss-loader", options: { // 如果没有options这个选项将会报错 No PostCSS Config found pl ...

  4. 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 ...

  5. 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 -- ...

  6. Vue+webpack报错: listen EADDRINUSE: address already in use :::8080

    如果本地运行多个vue+webpack项目会报错:listen EADDRINUSE: address already in use :::8080: 提示含义:地址端口已经被占用 注:8080指的是 ...

  7. 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 ...

  8. webpack报错Cannot read property 'presetToOptions' of undefined

    在学习react全家桶时,webpack首先报错,报错内容如下,最后我是因为没有全局安装webpack导致的报错,使用npm install webpack -g安装解决了这个问题.

  9. react脚手架抽离webpack报错解决

    我们在写react项目的时候,可能原有的webpack配置不满足我们的需求,需要自己去配置,可是你在创建脚手架的时候并不能在外部找到webpack文件,脚手架的webpack文件在node_modul ...

随机推荐

  1. 迭代器适配器{(插入迭代器back_insert_iterator)、IO流迭代器(istream_iterator、ostream_iterator)}

    一.迭代器适配器 反向迭代器 插入迭代器 IO流迭代器 其中反向迭代器可以参考以前的文章. 二.插入迭代器 插入迭代器实际上是一个输出迭代器(*it=; ++) back_insert_iterato ...

  2. WinForm下的键盘事件(KeyPress、KeyDown)及如何处理不响应键盘事件

    KeyDown事件用来处理功能键:F1 F2 F3... keyPress事件用来处理字符比如说:A B C... 1 2 3... 注:处理该事件时,需要先将窗体的 KeyPreview=true; ...

  3. atoi 和 itoa

    转自:http://www.cnblogs.com/cobbliu/archive/2012/08/25/2656176.html atoi 和 itoa是面试笔试经常要考到的题目,下面两份代码是用C ...

  4. Sql server注入简单认识

    登录界面常常会涉及到敏感关键字的注入 为了对应面试,再看一下 怎样防止注入, 可以过滤SQL需要参数中的敏感字符(忽略大小写) public static string Split(string in ...

  5. AutoFac文档(转载)

    目录 开始 注册组件 控制范围和生命周期 用模块结构化Autofac xml配置 与.net集成 深入理解Autofac 指导 关于 词汇表 开始 程序集 如果你正在使用Nuget包管理器,你可以通过 ...

  6. layui 数据表格 根据值(1=业务,2=机构)显示中文名称

    数据是用ThinkPHP5操作 类型是固定4个, 用layui templet - 自定义模板 方法一: {field:'type', title: '类型', width: 200, templet ...

  7. unity, Root Motion

    (引自:http://tieba.baidu.com/p/4323644080) 然后详细看了下这个文档:http://docs.unity3d.com/Manual/RootMotion.html ...

  8. unity, Rigidbody.constraints

    一,同时施加多个限制: 用按位或(bitwise OR)实现,例如: GetComponent<Rigidbody>().constraints=RigidbodyConstraints. ...

  9. Swift 的 pod 第三方库

    #HTTPpod 'Alamofire' #Elegant HTTP Networking in Swiftpod 'SwiftHTTP' #Thin wrapper around NSURLSess ...

  10. KVM部署LVS集群故障案例一则

    一.故障现象 KVM部署LVS(Linux Virtual Server)集群后,能够单独以HTTP方式访问RS(Real Server)的实际IP,但无法通过VIP(Virtual IP)访问. 二 ...