How to set optimizeDeps and alias?
mickeyvip opened this issue · comments
Hello,
I would like to be able to set optimizeDeps.include
and alias
(from Vite) and it does not seem to work.
Is that supported? How can I do this?
I need to load tailwindcss config in JavaScript and the problem is that it's CommonJS file, while Vite needs ES6 modules.
I got help in tailwindcss' discussions and the settings in vite.config.js
are working.
I am trying to set the same settings in my Vue2 project:
// vue.config.js
// ------------
const path = require('path');
module.exports = {
// ...
pluginOptions: {
vite: {
alias: {
'tailwind.config.js': path.resolve(__dirname, 'tailwind.config.js')
},
optimizeDeps: {
include: [
'tailwind.config.js'
]
}
}
}
}
// tailwind.theme.js
// ----------------
import tailwindConfig from 'tailwind.config.js';
// ...
And get:
Failed to resolve import "tailwind.config.js". Does the file exist?
Am I doing something wrong?
Thank you.
@mickeyvip will support it soon
@mickeyvip
pluginOptions.vite.alias
is deprecated, you must set it to vue-cli by configureWebpack or chainWebpack, and this plugin will auto-resolve it for vite
pluginOptions.vite.optimizeDeps
is fully supported. try it in v0.2.3