Как добавить кастом Css в nextjs - PullRequest
0 голосов
/ 30 мая 2020

Я пытался добавить эти Template в один из моих компонентов, этот компонент также получает другие значения динамически. Но вместо этого я получаю эту ошибку

You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders

Я также пробовал next-images in next.config.js, но все равно выдает ту же ошибку.

Это мой пакет. json

{
  "name": "frontend",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "dev": "next",
    "build": "next",
    "start": "next start"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "@zeit/next-css": "^1.0.1",
    "isomorphic-fetch": "^2.2.1",
    "js-cookie": "^2.2.1",
    "moment": "^2.25.3",
    "next": "^9.3.6",
    "nprogress": "^0.2.0",
    "prop-types": "^15.7.2",
    "query-string": "^6.12.1",
    "react": "^16.13.1",
    "react-dom": "^16.13.1",
    "react-modal": "^3.11.2",
    "react-quill": "^1.3.5",
    "react-render-html": "^0.6.0",
    "reactstrap": "^8.4.1"
  }
}

Обновление:

My next.config. js

const withCSS = require('@zeit/next-css')

module.exports = withCSS({

    publicRuntimeConfig : {
        APP_NAME : '  ',
        API_DEVELOPMENT : '',
        API_PRODUCTION : '',
        PRODUCTION:false

    }
})

1 Ответ

1 голос
/ 30 мая 2020

Попробуйте это в следующем файле конфигурации. js:

// next.config.js

const withCSS = require('@zeit/next-css')

module.exports = withCSS({

  cssLoaderOptions: {
    url: false

  }
})

...