naitbas
naitbas

Reputation: 11

How can I package my express app assets and scripts properly with zeit/pkg

I'm trying to package my express app with pkg on Windows 10.

When I package the app like so:

pkg package.json -t node10-latest-win-x64 -o webapp-win

the executable in the app directory works fine.

But I want to ship the app without my sources and configurations. Therefor my package.json looks like the following:

"pkg": {
     "scripts": [
      "config/config.js",
      "require.js",
      "controllers/**/*.js",
      "migrations/**/*.js",
      "models/**/*.js",
      "routes/**/*.js",
      "public/javascript/**/*.js"
    ],
    "assets": [
      "views/**/*",
      "public/assets/css/**/*.css",
      "public/assets/webfonts/**/*",
      "public/images/**/*.ico",
      "public/stylesheets/**/*.css",
      ".sequelizerc",
      "bin/**/*",
      "config/config.json"
    ]

The packaging again works fine and the executable works in the app directory. But when I trie to use it without say the config directory or the views directory it fails.

When I attach the --debug flag to the packaging it says: [debug] Stat info of %1 is added to queue and [debug] Content of %1 is added to queue for every file defined in the assets and scripts. I'm not sure what that means.

I'd be greatefull for every help I can get. I am really stuck. Thanks

Upvotes: 0

Views: 1174

Answers (1)

Younes Keraressi
Younes Keraressi

Reputation: 21

Just add --config package.json.

Upvotes: 0

Related Questions