Code Monkey home page Code Monkey logo

Comments (20)

forcePanda avatar forcePanda commented on June 25, 2024 2

Response from Salesforce support: "LWR is not supported on Windows." 🙃

from lwc.

nolanlawson avatar nolanlawson commented on June 25, 2024 1

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.

forcePanda avatar forcePanda commented on June 25, 2024 1

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.

nrkruk avatar nrkruk commented on June 25, 2024 1

@rahulgawale it should work on linux / mac osx, can you confirm you are hitting the same error stack trace on linux?

from lwc.

nrkruk avatar nrkruk commented on June 25, 2024 1

@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.

rahulgawale avatar rahulgawale commented on June 25, 2024 1

@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.

forcePanda avatar forcePanda commented on June 25, 2024 1

@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.

rahulgawale avatar rahulgawale commented on June 25, 2024 1

@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.
image

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.

juvian avatar juvian commented on June 25, 2024 1

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.

nolanlawson avatar nolanlawson commented on June 25, 2024 1

@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.

nrkruk avatar nrkruk commented on June 25, 2024 1

@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.

juvian avatar juvian commented on June 25, 2024 1

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.

nolanlawson avatar nolanlawson commented on June 25, 2024 1

@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.

rahulgawale avatar rahulgawale commented on June 25, 2024

@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.

rahulgawale avatar rahulgawale commented on June 25, 2024

@forcePanda What is supported then? it also doesn't work on Linux. Just curious, Did you raise a case for this?

from lwc.

rahulgawale avatar rahulgawale commented on June 25, 2024

@forcePanda Thanks for the update, I hope it will be fixed soon. At least it should work on Linux.

from lwc.

rahulgawale avatar rahulgawale commented on June 25, 2024

@nrkruk did you get any chance to look into this?

from lwc.

rahulgawale avatar rahulgawale commented on June 25, 2024

@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.

rahulgawale avatar rahulgawale commented on June 25, 2024

@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.

rahulgawale avatar rahulgawale commented on June 25, 2024

@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)

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.