0.0.2 • Published 1 year ago

@tzxhy/vite-plugin-case-sensitive v0.0.2

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

@tzxhy/vite-plugin-case-sensitive

vite 大小写敏感插件。Mac/Windows 下,文件路径是大小写不敏感的,可能导致相同的代码,在 linux 平台上构建失败。引入该插件后,当引入的 path 不存在时,提示报错,如下:

npm.io

安装

yarn add @tzxhy/vite-plugin-case-sensitive

使用

import {
    defineConfig,
} from 'vite';

import caseSensitivePlugin from '@tzxhy/vite-plugin-case-sensitive';

const ProjectPathDir = 'Your Project Path Dir';
const ProjectRootDir = 'Your Project Root Path Dir';

export default defineConfig((env) => {
    const plugins = [];
    if (env.mode !== 'production') {
        plugins.push(caseSensitivePlugin({
            // 监听相关文件夹下的修改。比如:重命名等
            watch: [
                path.join(ProjectPathDir, 'src'), // 项目 src 目录
                path.join(ProjectRootDir, 'src'), // 监听公共 src 目录
            ],
        }));
    }
    return {
        plugins,
        // ... other configs
    }
})
0.0.2

1 year ago

0.0.1

2 years ago