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" "url": "https://github.com/status-im/status-web/issues"
}, },
"scripts": { "scripts": {
"dev": "vite build --watch", "dev": "vite build --watch --mode development",
"build": "vite build && yarn typegen", "build": "vite build && yarn typegen",
"test": "vitest", "test": "vitest",
"lint": "eslint src", "lint": "eslint src",

View File

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

View File

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

View File

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

View File

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