0

The files in question are used by vscode-nls to localise Visual Studio Code extensions. They cannot be statically referenced because these files are not in the source code. They are generated by gulp build into the out folder.

I looked in the bundle and these files are missing. This may be the root cause of localize(key, default) always returning the default value in my webpacked extension. Either way it's not going to work till the files are bundled.

The glob would be out/**/extension.nls.*.json

How do I make webpack bundle these files when I can't reference them from source code?

How to copy static files to build directory with Webpack? was suggested as a potential solution, however this does not result in bundling. Adding this to webpack.config.js

  plugins: [
    new CopyPlugin({
      patterns: [
        { from: "out/**/extension.nls.*.json", to: "dist" }
      ]
    })
  ]

results in the files being copied to the dist folder. Given the name of the plugin that shouldn't come as a surprise, but the objective is to add them to the bundle.

Why is it so vital that the files be bundled?

  • They must continue to be available when the file system is redirected. This happens when my extension is used in conjunction with extensions for remoting to WSL or Docker containers.
  • I'm fed up with getting one-star reviews from people who install as one user and run as another, then blame my software for the fact that they cocked up access permissions. Everything goes in the bundle.
Peter Wone
  • 17,965
  • 12
  • 82
  • 134
  • Does this answer your question? [How to copy static files to build directory with Webpack?](https://stackoverflow.com/questions/27639005/how-to-copy-static-files-to-build-directory-with-webpack) – Mike Lischke Aug 30 '21 at 06:59
  • @MikeLischke this is a big part of the solution. I will give it a whirl. It certainly addresses the title question, although I suspect there are `vscode-nls` wrinkles to contend with. – Peter Wone Aug 30 '21 at 08:24

0 Answers0