Build failed due to webpack devServer importing https key

My vue application uses vue.config.js file which is similar to webpacks config file.

in development i have:

devServer: {
https: {
key: fs.readFileSync(’…/certs/’),
cert: fs.readFileSync(’…/certs/’),

it works fine when i build locally and run in dev locally.
But when cloudflare pages pulls it from github, the followiing error is shown :slight_smile:

ERROR Error: ENOENT: no such file or directory, open ‘…/certs/’

Not sure why when npm run buiild command is run it checks the devServer object and looks for the cert file which is not going to be there, nor do i want to upload it to my public folder as its only for local https.

Any ideas? Thanks.

Solved this by conditional checking the NODE_ENV process.

key: process.env.NODE_ENV == ‘development’ ? fs.readFileSync(’…/’) : ‘’,


This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.