Skip to content

Commit

Permalink
Allow updating module resolution in DEV environment
Browse files Browse the repository at this point in the history
  • Loading branch information
Fryuni committed Feb 7, 2024
1 parent 151be67 commit 5093c2d
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 2 deletions.
1 change: 1 addition & 0 deletions .changeset/pre.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"eleven-shrimps-rest",
"fresh-beers-dream",
"itchy-pants-happen",
"smart-fans-ring",
"tame-rivers-tie",
"thick-plums-prove"
]
Expand Down
5 changes: 5 additions & 0 deletions .changeset/smart-fans-ring.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@inox-tools/inline-mod": patch
---

Allow updating module resulution in DEV environment
6 changes: 6 additions & 0 deletions packages/inline-mod/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @inox-tools/inline-mod

## 1.1.0-smart-factory.4

### Patch Changes

- bd29c64: Allow updating module resulution in DEV environment

## 1.1.0-smart-factory.3

### Minor Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/inline-mod/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@inox-tools/inline-mod",
"version": "1.1.0-smart-factory.3",
"version": "1.1.0-smart-factory.4",
"description": "Define a virtual module inline with any reference to buildtime values",
"keywords": [
"vite-plugin"
Expand Down
3 changes: 2 additions & 1 deletion packages/inline-mod/src/vite.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'vite/types/importMeta.js';
import { magicFactory } from './closure/inspectCode.js';
import { InlineModuleError } from './closure/types.js';
import { inspectInlineMod, type InlineModule, type ModuleOptions } from './inlining.js';
Expand Down Expand Up @@ -31,7 +32,7 @@ export function inlineModule(options: ModuleOptions): string {
}

export function defineModule(name: string, options: ModuleOptions): string {
if (modRegistry.has(name)) {
if (import.meta.env.PROD && modRegistry.has(name)) {
throw new InlineModulePluginError(`Module "${name}" already defined.`);
}
modRegistry.set(name, inspectInlineMod(options));
Expand Down

0 comments on commit 5093c2d

Please sign in to comment.