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
{{ message }}
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.
Note: I'm reporting this bug for the record, but have a simple solution which I'll submit as a PR shortly.
Describe the bug
If sapper's current working directory and the src directory are the same, src_dir in manifest-server.mjs will be blank (and template.html will be unable to be found or served)
Logs
(ERROR) Error: ENOENT: no such file or directory, open '/template.html'
(ERROR) at Object.openSync (fs.js:440:3)
(ERROR) at Object.readFileSync (fs.js:342:35)
(ERROR) at read_template (webpack:///./node_modules/@sapper/server.mjs?:2497:41)
(ERROR) at template (webpack:///./node_modules/@sapper/server.mjs?:2158:11)
(ERROR) at handle_page (webpack:///./node_modules/@sapper/server.mjs?:2460:17)
(ERROR) at processTicksAndRejections (internal/process/task_queues.js:93:5) {
(ERROR) errno: -2,
(ERROR) syscall: 'open',
(ERROR) code: 'ENOENT',
(ERROR) path: '/template.html'
To Reproduce
Setup a custom sapper installation where the src files live in the root instead of src/ or some other custom subdirectory.
Expected behavior
With the proper arguments (--src, etc.), the system should function as normal.
Severity
This is a minor issue and will likely not come into play for most standard sapper installations, but in rare cases where the directory structure is more rigid, this can be a problem!
If cwd & dest or cwd & src are the path.relative will return a blank string. From the docs:
The path.relative() method returns the relative path from from to to based on the current working directory. If from and to each resolve to the same path (after calling path.resolve() on each), a zero-length string is returned.
In this case, however, a zero-length string produces undesired behavior (a dead location).
The solution is to wrap each call in path.normalize(), which instead of a zero-length string will produce "." as the result, pointing to the current directory (as it should).
The text was updated successfully, but these errors were encountered:
Note: I'm reporting this bug for the record, but have a simple solution which I'll submit as a PR shortly.
Describe the bug
If sapper's current working directory and the src directory are the same,
src_dir
in manifest-server.mjs will be blank (and template.html will be unable to be found or served)Logs
To Reproduce
Setup a custom sapper installation where the src files live in the root instead of src/ or some other custom subdirectory.
Expected behavior
With the proper arguments (--src, etc.), the system should function as normal.
Severity
This is a minor issue and will likely not come into play for most standard sapper installations, but in rare cases where the directory structure is more rigid, this can be a problem!
Additional context / investigation
The issue is based in src/core/create_app.ts:182-183
If cwd & dest or cwd & src are the path.relative will return a blank string. From the docs:
In this case, however, a zero-length string produces undesired behavior (a dead location).
The solution is to wrap each call in
path.normalize()
, which instead of a zero-length string will produce "." as the result, pointing to the current directory (as it should).The text was updated successfully, but these errors were encountered: