Skip to content

Commit

Permalink
build(projects): 环境变量获取方式变更
Browse files Browse the repository at this point in the history
  • Loading branch information
Soybean committed Nov 29, 2021
1 parent e53e793 commit 21c2f5a
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 24 deletions.
2 changes: 1 addition & 1 deletion README.md
@@ -1,4 +1,4 @@
<div style="text-align:center">
<div align="center">
<img src="https://i.loli.net/2021/11/24/x5lLfuSnEawBAgi.png"/>
<h1>Soybean Admin</h1>
</div>
Expand Down
50 changes: 27 additions & 23 deletions vite.config.ts
@@ -1,28 +1,32 @@
import { defineConfig } from 'vite';
import { defineConfig, loadEnv } from 'vite';
import path from 'path';
import { viteEnv, plugins, define } from './build';
import { plugins, define } from './build';

export default defineConfig({
base: viteEnv.VITE_BASE_URL,
resolve: {
alias: {
'@': path.resolve(__dirname, './src')
}
},
define,
css: {
preprocessorOptions: {
scss: {
additionalData: `@use "./src/styles/scss/global.scss" as *;`
export default defineConfig(({ mode }) => {
const viteEnv = loadEnv(mode, `.env.${mode}`);

return {
base: viteEnv.VITE_BASE_URL,
resolve: {
alias: {
'@': path.resolve(__dirname, './src')
}
},
define,
css: {
preprocessorOptions: {
scss: {
additionalData: `@use "./src/styles/scss/global.scss" as *;`
}
}
},
plugins,
server: {
host: '0.0.0.0'
},
build: {
brotliSize: false,
sourcemap: false
}
},
plugins,
server: {
host: '0.0.0.0'
},
build: {
brotliSize: false,
sourcemap: false
}
};
});

1 comment on commit 21c2f5a

@vercel
Copy link

@vercel vercel bot commented on 21c2f5a Nov 29, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.