cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Paul_2
New Member

PCF - possible webpack issue with Express npm module

Hi,

When using the Express npm module within a PCF control I'm getting the following warning and then a lot of errors:

WARNING in ./node_modules/express/lib/view.js 74:13-25
Critical dependency: the request of a dependency is an expression
@ ./node_modules/express/lib/application.js
@ ./node_modules/express/lib/express.js
@ ./node_modules/express/index.js

 

The advice I've found online is to use webpack-node-externals to exclude Express from being bundled.  If I look at webpackConfig.js in my PCF control then node modules are already excluded.  If I use webpack-node-externals anyway then this resolves the build errors but then my control doesn't load.

 

I'd be really grateful for any advice.

 

Thanks

 

Paul

2 REPLIES 2
Paul_2
New Member

Adding the following code to the webpack config seems to have fixed it:

externals: [{ 'express': { commonjs: 'express' } }]

Unfortunately, that's only going to solve your problem temporarily. An Initialized PCF attaches to npm install and writes over the webpack config a bit indelicately. So, the next time you (or someone who grabs your code) run npm install, it will overwrite your change and you'll need to edit config again.

 

(not the answer you were hoping for, I am sure)

 

@HemantG is this a known issue?

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (1,315)