Skip to content

Commit

Permalink
fix windows
Browse files Browse the repository at this point in the history
  • Loading branch information
patricklx committed Aug 21, 2024
1 parent a3e8c8d commit 804e429
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 6 additions & 4 deletions packages/vite/src/esbuild-resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,11 @@ export function esBuildResolver(): EsBuildPlugin {
switch (resolution.type) {
case 'found':
// if some addon imports app files we do not want to bundle it
const isInNodeModules =
resolution.filename.includes('/node_modules/') || resolution.filename.includes('@embroider/ext-es');
if (!isInNodeModules && importer !== '<stdin>') {
const isFromApp = !importer.includes('/node_modules/');
const filename = resolution.filename.replace(/\\/g, '/');
const fromFile = importer.replace(/\\/, '/');
const isInNodeModules = filename.includes('/node_modules/') || filename.includes('@embroider/ext-es');
if (!isInNodeModules && fromFile !== '<stdin>') {
const isFromApp = !fromFile.includes('/node_modules/');
if (!isFromApp) {
if (resolution.isVirtual) {
return {
Expand Down Expand Up @@ -94,6 +95,7 @@ export function esBuildResolver(): EsBuildPlugin {
return null;
}

// vite resolver does not take part when optimizing deps
const extensions = ['', '.hbs'];
for (const extension of extensions) {
let result = await build.resolve(path + extension, {
Expand Down
2 changes: 0 additions & 2 deletions test-packages/support/rebuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import type { ChildProcess } from 'child_process';
import { fork } from 'child_process';
import type Project from 'ember-cli/lib/models/project';
import type { Builder } from 'broccoli';
// import { rm } from 'fs-extra';

/*
A minimalist test harness for running ember-cli builds and rebuilds on demand.
Expand Down Expand Up @@ -137,7 +136,6 @@ async function main() {
for (let changed of m[1]) {
didChange(builder, changed);
}
// await rm('./tmp/rewritten-app', { recursive: true, force: true });
await builder.build();
sendToParent({ type: 'built', outputPath: builder.outputPath });
}
Expand Down

0 comments on commit 804e429

Please sign in to comment.