使用AWS Lambda无服务器进行Nuxt部署-内部服务器错误-CouldWatch:找不到模块'nuxt-purgecss'

问题描述 投票:0回答:1

我正在尝试在无服务器的情况下部署我的nuxt应用程序,但会收到错误消息“找不到模块'nuxt-purgecss'。]

任何想法都可以解决吗?

在我的nuxt.config.js下面

module.exports = {
  mode: "universal",
  /*
   ** Headers of the page
   */
  head: {
    title: process.env.APP_NAME,
    meta: [
      { charset: "utf-8" },
      { name: "viewport", content: "width=device-width, initial-scale=1" },
      {
        hid: "description",
        name: "description",
        content: process.env.npm_package_description || ""
      }
    ],
    link: [{ rel: "icon", type: "image/x-icon", href: "/favicon.ico" }]
  },
  /*
   ** Customize the progress-bar color
   */
  loading: { color: "#fff" },
  /*
   ** Global CSS
   */
  css: ["~/assets/sass/tailwind.sass"],
  /*
   ** Plugins to load before mounting the App
   */
  plugins: [
    "./plugins/global.js",
    "./plugins/mixins/responsive.js",
    "./plugins/sbkl-client.js"
  ],
  /*
   ** Nuxt.js dev-modules
   */
  buildModules: [],
  /*
   ** Nuxt.js modules
   */
  modules: [
    "@nuxtjs/axios",
    "@nuxtjs/dotenv",
    "@nuxtjs/auth",
    "portal-vue/nuxt",
    "nuxt-purgecss"
  ],
  /*
   ** Axios module configuration
   ** See https://axios.nuxtjs.org/options
   */
  axios: {
    baseURL: process.env.URL + "/api"
  },
  /*
   ** Build configuration
   */
  build: {
    /*
     ** You can extend webpack config here
     */
    extractCSS: true,
    postcss: {
      plugins: {
        tailwindcss: path.resolve(__dirname, "./tailwind.config.js")
      }
    },
    transpile: ["sbkl-client"],
    extend(config, ctx) {}
  },
  purgeCSS: {
    mode: "postcss",
    paths: ["node_modules/sbkl-client/**/*.vue", "admin.config.js"]
  }
};

我的package.json:

{
  "dependencies": {
    "@nuxtjs/auth": "^4.9.0",
    "@nuxtjs/axios": "^5.3.6",
    "@nuxtjs/dotenv": "^1.4.0",
    "@popperjs/core": "^2.1.0",
    "nuxt-start": "^2.11.0",
    "portal-vue": "^2.1.7",
    "sbkl-client": "^1.0.1",
    "serverless-nuxt": "^1.1.1"
  },
  "devDependencies": {
    "@tailwindcss/ui": "^0.1.3",
    "node-sass": "^4.13.1",
    "nuxt": "^2.11.0",
    "nuxt-purgecss": "^0.2.1",
    "sass-loader": "^8.0.2",
    "serverless-domain-manager": "^3.3.1",
    "serverless-nuxt-plugin": "^1.1.0",
    "tailwindcss": "^1.2.0"
  }
}
nuxt.js serverless-framework aws-serverless css-purge
1个回答
0
投票

由于构建需要将nuxt-purgecss从我的devDependencies移至我的依赖项,所以需要。

© www.soinside.com 2019 - 2024. All rights reserved.