unocss: ERROR in ./_virtual_\__uno.css 4:14-362 Module not found: Error: Can't resolve '../_virtual_/__uno.css'

Once I import uno.css in main.ts:

import 'uno.css'

An error happened:

ERROR in ./_virtual_\__uno.css 4:14-362
Module not found: Error: Can't resolve '../_virtual_/__uno.css' in '/MyProject/_virtual_\'

My deps:

"@unocss/webpack": "^0.32.12",
"unocss": "^0.30.6",

My webpack.config.js

const { defineConfig } = require("@vue/cli-service");
const { presetAttributify, presetUno, presetIcons } = require("unocss");

module.exports = defineConfig({
  transpileDependencies: true,
  chainWebpack: (config) => {
    config.resolve.extensions.add(".ts");
  },
  configureWebpack: {
    resolve: {
      fallback: {
        http: false,
        https: false,
        url: false,
        timers: false,
      },
    },
    plugins: [
      require("unplugin-icons/webpack")({
        autoInstall: true,
      }),
      require("@unocss/webpack").default({
        theme: {
          fontFamily: {
            sans: '"Inter", Inter var,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji',
          },
        },
        presets: [
          presetIcons({
            extraProperties: {
              display: "inline-block",
              height: "1.2em",
              width: "1.2em",
              "vertical-align": "text-bottom",
            },
          }),
          presetAttributify(),
          presetUno(),
        ],
      }),
    ],
  },
  lintOnSave: false,
  pluginOptions: {
    windicss: {
      // see https://github.com/windicss/vite-plugin-windicss/blob/main/packages/plugin-utils/src/options.ts
    },
  },
});

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 24 (15 by maintainers)

Most upvoted comments

@unocss/webpack package is still using 0.6.2 and we need 0.6.3: https://github.com/unocss/unocss/blob/main/packages/webpack/package.json#L46

@peterroe modified it exist this error?

this should work, I’m on Windows machine so I haven’t that problem, the unocss works

on linux(WSL), I met the same error, after temporarily modifed, it works on windows and linux