Giter VIP home page Giter VIP logo

Comments (11)

brandonroberts avatar brandonroberts commented on August 16, 2024 1

Ok, thanks. Will take a look

from analog.

brandonroberts avatar brandonroberts commented on August 16, 2024

Interesting. Try changing the occurrences of /spear to spear in the project.json

from analog.

PowerSupply avatar PowerSupply commented on August 16, 2024

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.

PowerSupply avatar PowerSupply commented on August 16, 2024

Any new insight? Or can I assist in any way?

from analog.

brandonroberts avatar brandonroberts commented on August 16, 2024

This seems to have been fixed in Nx. Try again with the latest release. Closing as resolved

from analog.

PowerSupply avatar PowerSupply commented on August 16, 2024

I just tested with Nx 17.0.2 and it is sadly not resolved. Still the same error.

from analog.

PowerSupply avatar PowerSupply commented on August 16, 2024

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.

PowerSupply avatar PowerSupply commented on August 16, 2024

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.

brandonroberts avatar brandonroberts commented on August 16, 2024

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.

PowerSupply avatar PowerSupply commented on August 16, 2024

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:

  1. sourceRoute and targets.lint.options.lintFilePatterns[0] starts with "./analog-app/" vs "/analog-app/" (working vs non-working)
  2. Paths in targets.build.outputs does not contain "//" in the in the working one (see project.json above for comparison)
  3. 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.

brandonroberts avatar brandonroberts commented on August 16, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.