Giter VIP home page Giter VIP logo

Comments (6)

MellowCo avatar MellowCo commented on June 9, 2024 1

uni-app in app mode QQ截图20220808112519

see this https://github.com/MellowCo/unocss-preset-weapp#uniapp-vue3-vite-app%E6%89%93%E5%8C%85%E4%B8%AD%E6%96%AD

from unocss-preset-uni.

zguolee avatar zguolee commented on June 9, 2024

Add uno.css to your main entry:

// main.ts
import 'uno.css'

from unocss-preset-uni.

MellowCo avatar MellowCo commented on June 9, 2024

uni-app in app mode QQ截图20220808112519

see this https://github.com/MellowCo/unocss-preset-weapp#uniapp-vue3-vite-app%E6%89%93%E5%8C%85%E4%B8%AD%E6%96%AD

原来是uniapp打包app时,打包了2次,加上模式判断就行了
// app打包配置
// uniapp打包app时,打包2次,一次使用 vue 模式打包h5,第2次使用 nvue 模式打包app,
// 第2次打包 unocss 会抛出warn
// entry module not found, have you add import 'uno.css' in your main entry?
// 导致打包终止
process.env.UNI_COMPILER === 'vue' ? Unocss() : undefined,

from unocss-preset-uni.

liwenfengg avatar liwenfengg commented on June 9, 2024

from unocss-preset-uni.

MellowCo avatar MellowCo commented on June 9, 2024

uni-app in app mode QQ截图20220808112519 > > > see this https://github.com/MellowCo/unocss-preset-weapp#uniapp-vue3-vite-app%E6%89%93%E5%8C%85%E4%B8%AD%E6%96%AD 原来是uniapp打包app时,打包了2次,加上模式判断就行了 // app打包配置 // uniapp打包app时,打包2次,一次使用 vue 模式打包h5,第2次使用 nvue 模式打包app, // 第2次打包 unocss 会抛出warn // entry module not found, have you add import 'uno.css' in your main entry? // 导致打包终止 process.env.UNI_COMPILER === 'vue' ? Unocss() : undefined,
process.env.UNI_COMPILER === 'vue' ? Unocss() : undefined, // 这样设置后 h5 就不行了  export default ({ command, mode }: ConfigEnv): UserConfigExport => { const env = loadEnv(mode, process.cwd()) log(colors.green('command '), command) log(colors.green('mode '), mode) log(colors.green('env '), env) log(colors.green('process.env.UNI_COMPILER'), process.env.UNI_COMPILER) return defineConfig({ resolve: { alias: { '~/': ${path.resolve(__dirname, 'src')}/, }, }, plugins: [ (command === 'serve' || (command === 'build' && process.env.UNI_COMPILER === 'vue')) ? Unocss() : undefined, // 我暂时时这样解决的

改成这样就行了

// app打包配置
// uniapp打包app时,打包2次,一次使用 vue 模式打包h5,第2次使用 nvue 模式打包app,
// 第2次打包 unocss 会抛出warn,导致打包终止
process.env.UNI_COMPILER !== 'nvue' ? Unocss() : undefined,

from unocss-preset-uni.

liwenfengg avatar liwenfengg commented on June 9, 2024

uni-app in app mode QQ截图20220808112519 > > > see this https://github.com/MellowCo/unocss-preset-weapp#uniapp-vue3-vite-app%E6%89%93%E5%8C%85%E4%B8%AD%E6%96%AD 原来是uniapp打包app时,打包了2次,加上模式判断就行了 // app打包配置 // uniapp打包app时,打包2次,一次使用 vue 模式打包h5,第2次使用 nvue 模式打包app, // 第2次打包 unocss 会抛出warn // entry module not found, have you add import 'uno.css' in your main entry? // 导致打包终止 process.env.UNI_COMPILER === 'vue' ? Unocss() : undefined,
process.env.UNI_COMPILER === 'vue' ? Unocss() : undefined, // 这样设置后 h5 就不行了  export default ({ command, mode }: ConfigEnv): UserConfigExport => { const env = loadEnv(mode, process.cwd()) log(colors.green('command '), command) log(colors.green('mode '), mode) log(colors.green('env '), env) log(colors.green('process.env.UNI_COMPILER'), process.env.UNI_COMPILER) return defineConfig({ resolve: { alias: { '~/': ${path.resolve(__dirname, 'src')}/, }, }, plugins: [ (command === 'serve' || (command === 'build' && process.env.UNI_COMPILER === 'vue')) ? Unocss() : undefined, // 我暂时时这样解决的

改成这样就行了

// app打包配置
// uniapp打包app时,打包2次,一次使用 vue 模式打包h5,第2次使用 nvue 模式打包app,
// 第2次打包 unocss 会抛出warn,导致打包终止
process.env.UNI_COMPILER !== 'nvue' ? Unocss() : undefined,

好的,谢谢你

from unocss-preset-uni.

Related Issues (7)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.