Skip to content

Commit 24f53db

Browse files
authored
fix: process.env.NODE_ENV is undefined (#19)
1 parent 60f7523 commit 24f53db

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

src/core/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@ import { type UnpluginFactory, createUnplugin } from 'unplugin';
22
import { createFilter } from '@rollup/pluginutils';
33
import { type ResolvedOptions, type Options } from '../types';
44
import { TRACE_ID } from './constants';
5+
import { isDev } from './isDev';
56
import { parse_ID } from './parse_ID';
67
import { transform } from './transform';
78

89
export const unpluginFactory: UnpluginFactory<Options> = (options = {}) => {
9-
if (process.env.NODE_ENV !== 'development') {
10+
if (!isDev()) {
1011
return {
1112
name: 'unplugin-vue-source',
1213
};

src/core/isDev.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export function isDev() {
2+
return !(process.env.NODE_ENV && process.env.NODE_ENV !== 'development');
3+
}

src/vue.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import { TRACE_ID } from './core/constants';
2+
import { isDev } from './core/isDev';
23
export default {
34
install(app: any) {
4-
if (process.env.NODE_ENV === 'development') {
5+
if (isDev()) {
56
app.mixin({
67
props: {
78
[TRACE_ID]: String,

0 commit comments

Comments
 (0)