C
C#17mo ago
Brady Kelly

How do I group several tokens to pass as a single value to an npm package parameter?

I am trying to set up an npm script to run a package called office-addin-debugging. This starts up an Office add-in web app configured for debugging. By default it starts up a web server with the webpack serve --mode development command. I need it to start the dev server with a webpack serve --mode development --config webpack.config.ie11.js command. Now the office-addin-debugging package does have a --web-server parameter where you are supposed to be able to pass a command that it will use instead of the default. So far I have the following npm script that does not work:
"startie11": "office-addin-debugging start manifest.xml --dev-server 'webpack serve --config webpack.config.ie11.js'"
"startie11": "office-addin-debugging start manifest.xml --dev-server 'webpack serve --config webpack.config.ie11.js'"
As you may notice I have tried to use single quotes to group together all the tokens that I want to pass as the web-server parameter, but this doesn't work. When I run this script I get the error:
error: unknown option '--config'
error: unknown option '--config'
So it seems that npm is seeing --options as an invalid parameter of the office-addin-debugging package and not part of the command line I wish to pass to the dev-server parameter.
1 Reply
Brady Kelly
Brady Kelly17mo ago
Wrapping the group of tokens I wanted passed to the --dev-server parameter worked nicely for me: "startie11": "office-addin-debugging start manifest.xml --dev-server \"webpack serve --config webpack.config.ie11.js\""