alexdevero/react-mobx-react-router-boilerplate

Module build failed: Error: No PostCSS Config found in: /src/styles

Nuqlear opened this issue · 0 comments

Hi. I want to thank you for your code and report an issue which I faced.

For some reason project is working fine locally but not in Docker container.

FROM node:latest
RUN apt-get update && apt-get install -y apt-transport-https
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
RUN apt-get update && apt-get install yarn
COPY src/ /src/
COPY dist/ /dist/
COPY index.hbs /
COPY package.json /
COPY .npmignore /
COPY postcss.config.js /
COPY webpack.config.js /
COPY webpack.config.production.js /
COPY yarn.lock /
WORKDIR .
RUN yarn
CMD yarn start
ERROR in /node_modules/css-loader!/node_modules/postcss-loader/lib!/node_modules/resolve-url-loader!/node_modules/sass-loader/lib/loader.js?sourceMap!/src/styles/main.scss
Module build failed: Error: No PostCSS Config found in: /src/styles
    at /node_modules/postcss-load-config/index.js:51:26
    at <anonymous>
 @ /src/styles/main.scss 2:14-226 21:1-42:3 21:224-42:2 22:19-231
 @ /src/index.js
 @ multi (webpack)-dev-server/client?http://0.0.0.0:1337 webpack/hot/dev-server react-hot-loader/patch webpack-dev-server/client?http://0.0.0.0:1337 webpack/hot/only-dev-server babel-polyfill whatwg-fetch ../src/index.js

I solved this by explicitly setting path to the postcss.config.js in webpack config files.

use: [
  { loader: 'style-loader'},
  { loader: 'css-loader', options: { sourceMap: true } },
  { loader: 'postcss-loader', options: { sourceMap: true, path: 'postcss.config.js' } },
  { loader: 'resolve-url-loader' },
  { loader: 'sass-loader', options: { sourceMap: true } }
]