ember-vite-hmr 1.8.1 → 1.8.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/lib/hmr.js +4 -2
  2. package/package.json +1 -1
package/dist/lib/hmr.js CHANGED
@@ -119,12 +119,11 @@ function hmr(enableViteHmrForModes = ['development']) {
119
119
  .toString();
120
120
  },
121
121
  resolveId(id, importer) {
122
- if (importer.startsWith(virtualPrefix)) {
122
+ if (importer === null || importer === void 0 ? void 0 : importer.startsWith(virtualPrefix)) {
123
123
  importer = path_1.default.join(process.cwd(), 'package.json');
124
124
  return this.resolve(id, importer);
125
125
  }
126
126
  if (id.startsWith(virtualPrefix)) {
127
- console.log('virtualPrefix id', id);
128
127
  return id;
129
128
  }
130
129
  if (id.startsWith('/@id/embroider_virtual:')) {
@@ -200,6 +199,9 @@ function hmr(enableViteHmrForModes = ['development']) {
200
199
  },
201
200
  transform(source, id) {
202
201
  return __awaiter(this, void 0, void 0, function* () {
202
+ if (process.env['EMBER_VITE_HMR_ENABLED'] !== 'true') {
203
+ return source;
204
+ }
203
205
  const resourcePath = id.replace(/\\/g, '/').split('?')[0];
204
206
  let didReplaceSources = false;
205
207
  const name = require(`${process.cwd()}/package.json`).name;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ember-vite-hmr",
3
- "version": "1.8.1",
3
+ "version": "1.8.3",
4
4
  "keywords": [
5
5
  "ember-addon"
6
6
  ],