TransWikia.com

LWC OSS Build Command

Salesforce Asked by Scott Morrison on February 3, 2021

I’m trying to build an LWC OSS project for production, but I can’t figure out where the ‘npm run build’ command builds the bundled resource. I don’t see anything obvious in the configs or on either of these sites

https://github.com/muenzpraeger/create-lwc-app/blob/main/packages/lwc-services/example/lwc-services.config.js
https://www.npmjs.com/package/@lwc/compiler

I’m using the default settings and I think it must be something here in the lwc-services.config.js

lwcCompilerOutput: {
    production: {
        compat: false,
        minify: true,
        env: {
            NODE_ENV: 'production'
        }
    }
}

can I specify a file name and location and what is the default file name and location?

One Answer

The default directory is "dist", but you can change this. Find your project.json file, and locate this section:

"scripts": {
    "build": "lwc-services build -m production",

And add the desired destination to the command:

"scripts": {
    "build": "lwc-services build -m production -d prod",

Where prod is the desired output directory.

Depending on what you're doing, you may need to update additional scripts, as they presume that dist is the source for your production build.

Answered by sfdcfox on February 3, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP