davidturissini / lwc-webpack-plugin Goto Github PK
View Code? Open in Web Editor NEWWebpack Plugin for LWC
Webpack Plugin for LWC
Trying to figure out if it's possible to bundle the lightning-base-components with an application (specifically seeing if I can get it to work with a react app).
I tried something like this in my webpack config:
new LWCWebpackPlugin({
namespace: {
// LWC Namespace with path
lightning: path.resolve(root, 'node_modules/lightning-base-components/src/lightning')
},
// NPM modules
modules: [
'@salesforce-ux/design-system',
]
}),
Was hoping this would let me reference the components via something like this:
<lightning-button
label="Neutral"
title="Non-primary action"
onclick={() => console.log('abc')}
class="slds-m-left_x-small"
></lightning-button>
Short
Since the a major use of this will be to handle work done in and around the Salesforce ecosystem, I'd like to request a way to append the slds imprort in each component.
Long
On sfdc platform, all components automatically receive access to the Salesforce Design System css. I believe this is because sfdc doesn't actually use the shadow dom, but a polyfill for it. This presents an issues in that the OSS lwc version does use shadow DOM. I'd like to style my compoents using
the slds without having to manually add the css to each component.
Work Around
For those components, that don't have css file. I update the empty.css to include a slds import( as demonstrated in the example). This works for components without css but doesn't for those that do.
I am attempting to add the LWCWebpackPlugin
to my webpack config (lwc-preset-framework) to add framework support to storybook, however when I debug the generated webpack-config, I am not seeing the plugin in the output of my webpack config as expected?
Do you have any ideas? A similar solution is represented here ( but this is overriding the entire webpack config for an individual project)
Running the example I get the following error:
Module not found: Error: Can't resolve '@salesforce/slds/common' in '/Users/gcordero/dist/lwc-webpack-plugin/example/src/my/app'
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.