set mode to development during dev

This commit is contained in:
Pavel Prichodko 2022-06-28 16:54:21 +02:00
parent 680ce2f79b
commit df6b52736e
No known key found for this signature in database
GPG Key ID: 0EB8D75C775AB6F1
5 changed files with 16 additions and 22 deletions

View File

@ -19,7 +19,7 @@
"url": "https://github.com/status-im/status-web/issues"
},
"scripts": {
"dev": "vite build --watch",
"dev": "vite build --watch --mode development",
"build": "vite build && yarn typegen",
"test": "vitest",
"lint": "eslint src",

View File

@ -1,6 +1,5 @@
/// <reference types="vitest" />
import { resolve } from 'node:path'
import { defineConfig } from 'vite'
import { dependencies } from './package.json'
@ -10,21 +9,17 @@ const external = [
// ...Object.keys(peerDependencies || {}),
].map(name => new RegExp(`^${name}(/.*)?`))
export default defineConfig(({ command }) => {
export default defineConfig(({ mode }) => {
return {
resolve: {
alias: {
'~': resolve('.'),
},
},
build: {
target: 'es2020',
lib: {
entry: './src/index.ts',
fileName: 'index',
formats: ['es'],
},
target: 'es2020',
emptyOutDir: command === 'build',
sourcemap: true,
emptyOutDir: mode === 'production',
rollupOptions: {
external,
},

View File

@ -19,7 +19,7 @@
"url": "https://github.com/status-im/status-web/issues"
},
"scripts": {
"dev": "vite build --watch",
"dev": "vite build --watch --mode development",
"build": "vite build && yarn typegen",
"#test": "vitest",
"typecheck": "tsc",

View File

@ -46,9 +46,9 @@ export const Community = (props: Props) => {
return (
<Router>
<AppProvider config={props}>
<ThemeProvider theme={theme}>
<ProtocolProvider options={{ publicKey: props.publicKey }}>
<ProtocolProvider options={{ publicKey: props.publicKey }}>
<AppProvider config={props}>
<ThemeProvider theme={theme}>
<DialogProvider>
<GlobalStyle />
<Wrapper>
@ -65,9 +65,9 @@ export const Community = (props: Props) => {
</Routes>
</Wrapper>
</DialogProvider>
</ProtocolProvider>
</ThemeProvider>
</AppProvider>
</ThemeProvider>
</AppProvider>
</ProtocolProvider>
</Router>
)
}

View File

@ -11,7 +11,7 @@ const external = [
...Object.keys(peerDependencies || {}),
].map(name => new RegExp(`^${name}(/.*)?`))
export default defineConfig(({ command }) => {
export default defineConfig(({ mode }) => {
return {
resolve: {
alias: {
@ -19,15 +19,14 @@ export default defineConfig(({ command }) => {
},
},
build: {
target: 'es2020',
lib: {
entry: './src/index.tsx',
fileName: 'index',
formats: ['es'],
},
emptyOutDir: command === 'build',
// sourcemap: true,
target: 'es2020',
sourcemap: true,
emptyOutDir: mode === 'production',
rollupOptions: {
external,
},