Comments (11)
Ok, thanks. Will take a look
from analog.
Interesting. Try changing the occurrences of /spear
to spear
in the project.json
from analog.
Tried that, no difference. Also there are paths with "//" which I don't think should be there. Didnt make a difference when I changed it.
from analog.
Any new insight? Or can I assist in any way?
from analog.
This seems to have been fixed in Nx. Try again with the latest release. Closing as resolved
from analog.
I just tested with Nx 17.0.2 and it is sadly not resolved. Still the same error.
from analog.
I think the problem is that the path is resolved from the very root of the disk and not the root of the Nx workspace. EDIT: this was not the problem
from analog.
this is options.configFile that gets passed into normalizeViteConfigFilePath (EDIT: this is the options object):
{
main: '/analog-app/src/main.ts',
configFile: '/analog-app/vite.config.ts',
outputPath: 'dist/analog-app/client',
tsConfig: '/analog-app/tsconfig.app.json',
mode: 'development',
buildLibsFromSource: true,
skipTypeCheck: false,
fileReplacements: [],
emptyOutDir: true,
watch: false,
buildTarget: 'analog-app:build:development',
port: 4200,
hmr: true
}
from analog.
I tried with these options and it works correctly.
$npx create-nx-workspace@latest analog-nx-paths
Need to install the following packages:
[email protected]
Ok to proceed? (y)
> NX Let's create a new workspace [https://nx.dev/getting-started/intro]
✔ Which stack do you want to use? · none
✔ Package-based monorepo, integrated monorepo, or standalone project? · integrated
✔ Enable distributed caching to make your CI faster · No
> NX Creating your v17.0.2 workspace.
To make sure the command works reliably in all environments, and that the preset is applied correctly,
Nx will run "npm install" several times. Please wait.
✔ Installing dependencies with npm
✔ Successfully created the workspace: analog-nx-paths.
——————————————————————————————————————————————————————————————————————————————————
> NX First time using Nx? Check out this interactive Nx tutorial.
https://nx.dev/getting-started/tutorials/package-based-repo-tutorial
$cd analog-nx-paths
$npm i @analogjs/platform --save-dev
npm WARN deprecated @babel/[email protected]: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-unicode-property-regex instead.
npm WARN deprecated @babel/[email protected]: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-async-generator-functions instead.
npm WARN deprecated [email protected]: Use your platform's native performance.now() and performance.timeOrigin.
npm WARN deprecated @wessberg/[email protected]: this package has been renamed to ts-evaluator. Please install ts-evaluator instead
added 639 packages, and audited 1013 packages in 42s
123 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
$nx g @analogjs/platform:app analog-app
> NX Generating @analogjs/platform:app
✔ Add TailwindCSS for styling? (Y/n) · true
✔ Add tRPC for typesafe client/server interaction? (y/N) · false
Angular has not been installed yet. Creating an Angular application
Fetching @nx/angular...
Fetching prettier...
UPDATE package.json
UPDATE nx.json
CREATE tsconfig.base.json
CREATE .prettierrc
CREATE .prettierignore
UPDATE .vscode/extensions.json
UPDATE .gitignore
CREATE analog-app/project.json
CREATE analog-app/.eslintrc.json
CREATE analog-app/index.html
CREATE analog-app/src/app/app.component.spec.ts
CREATE analog-app/src/app/app.component.ts
CREATE analog-app/src/app/app.config.server.ts
CREATE analog-app/src/app/app.config.ts
CREATE analog-app/src/favicon.ico
CREATE analog-app/src/main.server.ts
CREATE analog-app/src/main.ts
CREATE analog-app/src/public/assets/.gitkeep
CREATE analog-app/src/public/assets/analog.svg
CREATE analog-app/src/server/routes/v1/hello.ts
CREATE analog-app/src/styles.css
CREATE analog-app/src/test-setup.ts
CREATE analog-app/src/vite-env.d.ts
CREATE analog-app/tsconfig.app.json
CREATE analog-app/tsconfig.editor.json
CREATE analog-app/tsconfig.json
CREATE analog-app/tsconfig.spec.json
CREATE analog-app/vite.config.ts
CREATE analog-app/tailwind.config.js
CREATE analog-app/postcss.config.js
CREATE analog-app/src/app/pages/(home).page.ts
CREATE analog-app/src/app/pages/analog-welcome.component.ts
CREATE .eslintrc.json
CREATE .eslintignore
What steps did you take?
from analog.
Yes, it works if you are Creating a Standalone Nx project, like you did. It does not work if you are Adding to an existing Nx workspace, like I wrote I did in the description. And the problem is with serving the newly generated app, not just generating it.
I made a diff of the project.json for the app created in the standalone Nx project and the one in my existing workspace. The differences are:
- sourceRoute and targets.lint.options.lintFilePatterns[0] starts with "./analog-app/" vs "/analog-app/" (working vs non-working)
- Paths in targets.build.outputs does not contain "//" in the in the working one (see project.json above for comparison)
- Paths in targets.build.options does not lead with "/" in the working one or contain "//".
After changing the paths, it works. So the bug is that the wrong paths are being generated when using the generator in an existing Nx workspace. I don't know why changing paths earlier didn't work.
from analog.
Right. What I'm saying is generating a new workspace + using the generator should be the same as having an existing workspace + using the generator.
I didn't create a standalone Nx project. I created a new empty workspace without the preset, installed the package and used the generator to generate the app.
There was a fix for Nx relevant to this here #617
You may want to check that you're installing the latest version using @analogjs/platform@latest
and not an old cached version.
from analog.
Related Issues (20)
- Importing `injectContent` in root causes the dev server to hang? HOT 2
- Documentation for `@analogjs/vitest-angular` is using imports from `@analogjs/vite-plugin-angular` HOT 2
- <ng-container /> not working HOT 1
- `@analogjs/vite-plugin-angular/setup-vitest` pull zone.js HOT 6
- SSG File Structure Router
- Sourcemaps mismatch when adding @analogjs/vitest-angular as test-runner in Angular application
- Angular's vite plugin doesn't consume code transformation of previous vite plugin in the chain HOT 3
- Create project with [email protected] and cannot run npm i HOT 1
- Inconsistent test when running in Nx HOT 1
- Module import only working with relative path, path alias or project root path not working HOT 3
- Analog not working with Create Cloudflare CLI HOT 2
- Including {slugs} in sitemap when using blogtype (SSG) HOT 1
- Event replay js-actions aren't working HOT 2
- TypeError: Cannot read properties of undefined (reading 'minimalContext') HOT 3
- [Bug] An unhandled exception occurred: Workspaces is not a constructor HOT 6
- Unit tests launch with ng test always succeed
- Build fails when using algoliasearch HOT 1
- [FEAT]: Add support for bun:test to angular test integrations HOT 1
- No console logs when testing HOT 5
- HMR doesn't work properly when a `base` property is set in the Vite config
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from analog.