终端里运行的错误:

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

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. C#:xml操作(待补充)

    using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.X ...

  2. DevExpress中chartControl中实现统计图功能

    public partial class Form1 : DevExpress.XtraEditors.XtraForm { public Form1() { InitializeComponent( ...

  3. Python 爬虫实例(5)—— 爬取爱奇艺视频电视剧的链接(2017-06-30 10:37)

    1. 我们找到  爱奇艺电视剧的链接地址 http://list.iqiyi.com/www/2/-------------11-1-1-iqiyi--.html 我们点击翻页发现爱奇艺的链接是这样的 ...

  4. python--迭代器的实现

    #!/usr/local/python/bin/python3 """ 一个迭代器的例子 """ class exsample(object ...

  5. GameObject非激活状态,触发测试

    测试结果为OnEnable,Start不执行.Awake不管激活未激活都执行 不管是驻留在层级面板,还是手动拖上去. 但是,在任何时间设为激活.就会2个都触发.Awake和Start只触发一次.这个问 ...

  6. JMeter学习笔记(三)

    D. User Defined Variables:用户自定义的变量,在此我们可以定义后面原件需要引用的变量并对其进行赋值.jsessionid一般是服务器返回的,每个用户返回的都不一样,所以在此不应 ...

  7. 每日英语:When Social Skills Are A Warning

    An uncle starts believing all your sarcastic comments. Or a kindhearted friend never understands any ...

  8. JS中声明全局变量

    JS中声明全局变量主要分为显式声明或者隐式声明下面分别介绍. 声明方式一: 使用var(关键字)+变量名(标识符)的方式在function外部声明,即为全局变量,否则在function声明的是局部变量 ...

  9. 高德地图API INVALID_USER_SCODE问题以及keystore问题

    今天这篇文章会给大家介绍三个问题: 1,接入API时出现invalid_user_scode问题 首先进行第一个大问题,接入高德地图API时出现invalid_user_scode问题 因为项目需要接 ...

  10. oracle存储过程函数

    1.函数 create or replace function get_Destroy_no return varchar2 is Result varchar2(50);begin SELECT m ...