You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I just started to compose a bug report without being able to reproduce the issue outside my local environment when I found the culprit: An innocent space character in one of the parent folder's name.
Steps to reproduce:
Create a folder with a space in it, e.g. mkdir Project\ Name and change into it.
Run npm create astro@latest and select 'an empty project', say yes to 'install npm dependencies', say no to 'initialize a new git repository', choose the 'Strict' TypeScript setup, and change into the newly created folder.
Append the following lines to src/pages/index.astro:
<script>console.log('Hello, World.')</script>
Run npm run dev.
Visit http://127.0.0.1:3000/ as advertised in the command line.
The following exception is thrown in the CLI, blocking the page from being rendered in the browser.
error Could not import `/src/pages/index.astro?astro&type=script&index=0&lang.ts`.
Hint:
This is often caused by a typo in the import path. Please make sure the file exists.
Stacktrace:
Error: failed to load module for ssr: /src/pages/index.astro?astro&type=script&index=0&lang.ts
at instantiateModule (file:///Users/user/Projects/Project%20Name/majestic-mass/node_modules/vite/dist/node/chunks/dep-5605cfa4.js:53281:15)
Note that building the project (running npm run build and then npm run preview) works just fine and yields the expected result. Thus, this seems to be related to esbuild only.
After some work I was able to reproduce the issue on Stackblitz, so the issue is no longer restricted to my local environment.
(I needed to manually replace project name by project%20name as even Stackblitz does not seem to work properly with spaces)
Participation
I am willing to submit a pull request for this issue.
The text was updated successfully, but these errors were encountered:
ffraenz
changed the title
Astro’s development server can't bundle scripts when there is a space character in a parent folder
Astro’s dev server can't bundle when there is a space in a parent folder
Dec 13, 2022
What version of
astro
are you using?1.6.15
Are you using an SSR adapter? If so, which one?
None
What package manager are you using?
npm
What operating system are you using?
M1 macOS
Describe the Bug
I just started to compose a bug report without being able to reproduce the issue outside my local environment when I found the culprit: An innocent space character in one of the parent folder's name.
Steps to reproduce:
Create a folder with a space in it, e.g.
mkdir Project\ Name
and change into it.Run
npm create astro@latest
and select 'an empty project', say yes to 'install npm dependencies', say no to 'initialize a new git repository', choose the 'Strict' TypeScript setup, and change into the newly created folder.Append the following lines to
src/pages/index.astro
:Run
npm run dev
.Visit
http://127.0.0.1:3000/
as advertised in the command line.The following exception is thrown in the CLI, blocking the page from being rendered in the browser.
Note that building the project (running
npm run build
and thennpm run preview
) works just fine and yields the expected result. Thus, this seems to be related to esbuild only.After some work I was able to reproduce the issue on Stackblitz, so the issue is no longer restricted to my local environment.
Link to Minimal Reproducible Example
https://stackblitz.com/edit/github-q52vqt?file=project%20name/src/pages/index.astro
(I needed to manually replace
project name
byproject%20name
as even Stackblitz does not seem to work properly with spaces)Participation
The text was updated successfully, but these errors were encountered: