Comments (20)
Response from Salesforce support: "LWR is not supported on Windows." 🙃
from lwc.
Thanks for reporting! I've notified the LWR team (LWR is not hosted in this repo, which is for the the LWC open-source framework).
Do you get the same error in WSL? The stacktrace you provide seems to be from raw Windows (cmd.exe or some other terminal I assume).
from lwc.
Response from support:
Engineering has logged this as a bug and for now, it looks like it will only work on mac os.
https://issues.salesforce.com/issue/a028c00000yx5yH/lwr-build-is-not-working-in-both-wsl-and-windows
from lwc.
@rahulgawale it should work on linux / mac osx, can you confirm you are hitting the same error stack trace on linux?
from lwc.
@forcePanda @rahulgawale if either of you could share your actual github repositories with me (or an example repository that replicates the issue) - I will take a look at it
from lwc.
@nrkruk Thanks, I tried to run my code in Mac OSX and it works, but not everyone in our team has that. I have to set up Linux on my machine, once done I will try that out, also I will share the repository tomorrow. Thank you very much for looking into this.
from lwc.
@nrkruk the build works on Linux but there is an exception. The linux build output fails to show slds icons that are used in lwc base components.
Mac OS works fine for all the scenarios I've come across.
from lwc.
@nrkruk Here is the repo with the sample code. - https://github.com/rahulgawale/lwr-site-demo
Please note that I have not added the SLDS assets in the repo, which you can copy from the node module as per the docs - Set up Salesforce Lightning Design System
Screenshot of my assets folder for your reference.
As said by @forcePanda build works on Linux with an exception of icons not showing. There are some warnings when npm run build
command is executed. See the command output below.
rahul@rahul-ubuntu:~/Public/lwr-site-demo$ npm run build
> [email protected] build
> lwr build --clean
[info][build] Building lwr application
[info][build] Clearing output directory: site
[info][ssg] Static Site Generation
[info][ssg] Building routes (this may take some time to complete)
[info][ssg] en-US / in 732 ms
[warn][ssg] Could not find assets to copy at path: /home/rahul/Public/lwr-site-demo/site/fonts
[warn][ssg] Could not find assets to copy at path: /home/rahul/Public/lwr-site-demo/site/lightning.utilitySprite
[warn][ssg] Could not find assets to copy at path: /home/rahul/Public/lwr-site-demo/site/lightning.standardSprite
[info][ssg] Static Site Generation complete in 2 seconds
rahul@rahul-ubuntu:~/Public/lwr-site-demo$
Errors in LWR Docs
I would also like to bring it to your attention that there is a bug in the documentation - i.e. (https://developer.salesforce.com/docs/platform/lwr/guide/lwr-slds.html?q=styles#set-up-salesforce-lightning-design-system)
The copy-slds.mjs
code does not work at all. It gets executed but does not copy the assets from node module to /src/assets
folder, so you have to do that manually.
Also the package.json
snippet has syntax error, see below.
Actual snippet:
There are two (`) back ticks, which are not needed.
{
"scripts": {
"build": "`node ./scripts/copy-slds.mjs"`
}
}
Correct snippet:
Removed the back ticks.
{
"scripts": {
"build": "node ./scripts/copy-slds.mjs"
}
}
Also another issue with the docs is that the commands are not consistent, some pages use npm
to run commands but some pages use yarn
so it is kind of confusing. Wondering if package manager has anything to do with the error? Because I am using npm
.
from lwc.
Thanks for reporting! I've notified the LWR team (LWR is not hosted in this repo, which is for the the LWC open-source framework).
@nolanlawson What is the correct way of addressing issues for LWR? Making an issue here? I have been working several months on a website with LWR and sometimes I find bugs that I end up having to solve locally in the files. Sometimes it seems very weird that these things everyone should have issues with persist. Like for example right now I'm stuck with a bug with modals that don't open because isOverlayAllowedToAdd rejects which is caused by the class being imported twice in 2 different bundles
from lwc.
@juvian All I can say is that this repo is only concerned with the open-source LWC framework, not with LWR. LWR is currently closed-source, and there is no equivalent GitHub repo we can move this issue to.
If you remain blocked, I would recommend opening a Salesforce Stack Exchange question or a Salesforce case.
from lwc.
@rahulgawale - I did take a look, and there are definitely some path resolution issues we need to fix on windows. I'm working on getting that prioritized with the team but I don't have a definitive timeline on when that will be fixed for you.
You are correct in that the documentation is wrong here. If you fix the paths in the script, it will copy the assets as expected:
cpx.copy('./node_modules/@salesforce-ux/design-system/assets/**/*', './src/assets', () => {
console.log('Done copying SLDS resources');
});
It also appears that the lightning sprites and the /font directory are not included in the ux design system package, so will need to check on what the correct steps are for those assets. I've filed a bug on our doc team.
What package manager you use doesn't matter as far as LWR is concerned, both npm and yarn will work fine.
from lwc.
I got it to work on windows months ago (at least development mode, prod doesn't work) by changing these files
@lwrjs\asset-registry/build/cjs/index.cjs
async delegateGetAsset(assetIdentifier) {
if (assetIdentifier.specifier.includes('\\') && assetIdentifier.specifier.includes('assets')) {
assetIdentifier.specifier = assetIdentifier.specifier.replaceAll('\\', '/').replaceAll('//', '/');
}
@lwrjs\module-registry\build\cjs\linker\linker.cjs
let link = strategy(importRef, runtimeEnvironment, runtimeParams, signature);
// replace all locations of importee with the link
if (link.includes('\\utils') || link.includes('lightning_iconSvgTemplatesUtility')) {
link = link.replaceAll('\\', '#');
}
@lwrjs\module-registry\build\cjs\index.cjs
resolveModuleUriSync
if (moduleId.specifier.includes('#')) {
return uri.replaceAll('\\', '_');
}
from lwc.
@rahulgawale LWR is our recommended path forward. However we do ship a Rollup plugin and webpack plugin, but it's not a batteries-included meta-framework. create-lwc-app
is deprecated.
from lwc.
@nolanlawson Yes I am getting a similar error in WSL too. Added the stack trace from WSL to the Actual Results [WSL]
section. The build works just fine until I add the Lightning Base Components and SLDS. The problem occurs as soon as I add these two.
Also
Is there a separate public repo for lwr? If yes please drop in the link because I couldn't find one.
from lwc.
@forcePanda What is supported then? it also doesn't work on Linux. Just curious, Did you raise a case for this?
from lwc.
@forcePanda Thanks for the update, I hope it will be fixed soon. At least it should work on Linux.
from lwc.
@nrkruk did you get any chance to look into this?
from lwc.
@juvian Thanks for the workaround, I have been using your workaround hoping that someday it will be fixed. Kept using it in dev mode, but now I need to build and deploy my site. At least I expected this to work properly on Linux, but that is not the case either. Honestly, LWC OSS is a great framework but it does not provide any trustworthy build mechanism for Windows, I have also tried to use Webpack and Rollup but that didn't work either.
from lwc.
@nolanlawson Could you provide any alternative way to build static LWC OSS site? Maybe using Webpack or Rollup? Something similar to create-lwc-app
from lwc.
@nolanlawson I hope you are doing great! Just wanted to check if any update on the fix for the issue. Thanks
from lwc.
Related Issues (20)
- Discrepancy between `@lwc/engine-dom` and `@lwc/engine-server` static parts application HOT 1
- [Static content optimization] `<iframe>` `onload` events may not fire
- Avoid recursively setting `KEY__SHADOW_RESOLVER`
- [Static optimization] Allow `key` directive HOT 1
- Support arguments for FACE callbacks
- [Static optimization] Concatenate adjacent static blocks
- Fix `className` types in `engine-core`
- Audit and consolidate usage of `null` and `undefined` in the engine HOT 1
- Investigate invalid types generated in `@lwc/shared/language.ts` HOT 1
- Adding multiple animations to an element breaks compiler's keyframe name replacement. HOT 2
- [HMR] `swapStyle()` API should swap CSS content rather than appending it HOT 3
- LWC compiler errors on `.jsx`/`.tsx` files HOT 6
- Normalize whitespace for `style` and `class` attributes (breaking change) HOT 2
- Inline styles do not parse `! important` correctly due to extra whitespace HOT 15
- Bundle our licenses correctly in our npm packages
- lwr project does not run anymore (sudden death) HOT 1
- Use `node:` protocol for all builtin imports (`fs`, `path`, etc.) HOT 1
- Specify the minimum supported version of Node in `engines` HOT 1
- Reduce verbosity in `template.stylesheets` generated code
- Switch from Jest to Vitest HOT 1
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 lwc.