Closed Miciurash closed 3 years ago
Any update on this? I'm trying to get the same thing to work.
@Miciurash @dbrody This is fixed via 1f534317d03251deaf231e2f5f3de0905b4627e7 and is part of latest release, ie v11.2.0
One thing I noticed though in your configuration, is that assets
should be an array, inside the options
.
"options": {
.....
"assets": [
{
"input": "libs/shared/assets/src/lib",
"glob": "**/*",
"output": "assets"
}
],
.....
Thank you @bekos — this helped me to figure out how to get an assets folder, sitting in the root of the repository, outside of the nx workspaces subfolder properly referenced.
I'm new to nx and googled quite a bit: Is there a schema definition file or deeper documentation of all the properties the project.json
can take? In this one here i.e. doesn't mention assets.
Thank you @bekos — this helped me to figure out how to get an assets folder, sitting in the root of the repository, outside of the nx workspaces subfolder properly referenced.
I'm new to nx and googled quite a bit: Is there a schema definition file or deeper documentation of all the properties the
project.json
can take? In this one here i.e. doesn't mention assets.
I was wondering the same questions. Didn't really understand how people wrote stuff without any documentation on it. But if I'm not mistaken NX started as some kind of extension(?) to Angular CLI. So I had a look there and it did help me. Not sure if it's exactly corresponding to nx, but looks lika a lot of things are the same.
Thank you @bekos! Not sure how this got lost in my threads!
We are having the same issue.
We have followed this guide: https://nx.dev/recipes/other/deploy-nextjs-to-vercel but the public folder is not being considered.
Steps:
npx nx g @nrwl/next:app my-new-app
robots.txt
inside of apps/my-new-app/publicnpx nx build my-new-app --prod
robots.txt
is not included in dist/apps/my-new-app/.next
🚨Result: no robots.txt
for our website in vercel
Nx 14.8.6 Next 12.3.1
UPDATE: We have found a solution...
By adding --outputPath=.
to the Vercel build command:
This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.
[x ] I am running the latest version [x ] I checked the documentation (nx.dev) and found no answer [x ] I checked to make sure that this issue has not already been filed [x ] I'm reporting the issue to the correct repository (not related to React, Angular or any dependency)
Current Behavior
When creating a shared assets library the assets are not copied to the public folder in Next.js
Expected Behavior
Assets mapping should work for Next.js similar to how it works for other app types. Not sure if this was ever implemented because Next.js has a different folder structure.
Steps to Reproduce
Run the project in this repo: https://github.com/Miciurash/nx-nextjs-shared-assets-bug/tree/main/bug-nextjs-shared-assets
There is a cat.jpg image that is supposed to be shared from libs to the nextjs app.
I think it might be related to #3019 (https://github.com/nrwl/nx/issues/3019)
Failure Logs
Failed to load resource: the server responded with a status of 404 (Not Found) for http://localhost:4200/assets/cat.jpg
Environment
Node : 15.3.0 OS : darwin x64 npm : 6.14.10
nx : Not Found @nrwl/angular : Not Found @nrwl/cli : 11.0.20 @nrwl/cypress : 11.0.20 @nrwl/devkit : 11.0.20 @nrwl/eslint-plugin-nx : 11.0.20 @nrwl/express : Not Found @nrwl/jest : 11.0.20 @nrwl/linter : 11.0.20 @nrwl/nest : Not Found @nrwl/next : 11.0.20 @nrwl/node : Not Found @nrwl/react : 11.0.20 @nrwl/schematics : Not Found @nrwl/tao : 11.0.20 @nrwl/web : 11.0.20 @nrwl/workspace : 11.0.20 typescript : 4.0.5