Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion build/webpack/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ exports.nodeModulesToExternalize = [
'@koa/cors',
'koa',
'koa-compress',
'koa-logger'
'koa-logger',
'zeromq'
];
exports.nodeModulesToReplacePaths = [...exports.nodeModulesToExternalize];
function getDefaultPlugins(name) {
Expand Down
12 changes: 11 additions & 1 deletion build/webpack/webpack.extension.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// Licensed under the MIT License.
'use strict';

const copyWebpackPlugin = require('copy-webpack-plugin');
const removeFilesWebpackPlugin = require('remove-files-webpack-plugin');
const path = require('path');
const tsconfig_paths_webpack_plugin = require('tsconfig-paths-webpack-plugin');
const constants = require('../constants');
Expand Down Expand Up @@ -76,7 +78,15 @@ const config = {
]
}
]
})
}),
// ZMQ requires prebuilds to be in our node_modules directory. So recreate the ZMQ structure.
// However we don't webpack to manage this, so it was part of the excluded modules. Delete it from there
// so at runtime we pick up the original structure.
new removeFilesWebpackPlugin({ after: { include: ['./out/client/node_modules/zeromq.js'] } }),
new copyWebpackPlugin([{ from: './node_modules/zeromq/**/*.js' }]),
new copyWebpackPlugin([{ from: './node_modules/zeromq/**/*.node' }]),
new copyWebpackPlugin([{ from: './node_modules/zeromq/**/*.json' }]),
new copyWebpackPlugin([{ from: './node_modules/node-gyp-build/**/*' }])
Copy link

@DonJayamanne DonJayamanne Mar 13, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this work? Will this be cross play?
I thought we'd be using the prebuilt binaries, instead of using npm install?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is installing the prebuilt binaries into the node_modules directory. The '.node' files are the prebuilt binaries.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then they end up in the vsix this way

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Otherwise it wouldn't have worked on my linux machine

],
resolve: {
alias: {
Expand Down
1 change: 1 addition & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -709,6 +709,7 @@ function hasNativeDependencies() {
path.dirname(item.substring(item.indexOf('node_modules') + 'node_modules'.length)).split(path.sep)
)
.filter(item => item.length > 0)
.filter(item => !item.includes('zeromq')) // This is a known native. Allow this one for now
.filter(
item =>
jsonProperties.findIndex(flattenedDependency =>
Expand Down
1 change: 1 addition & 0 deletions news/3 Code Health/10483.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add ZMQ library to extension
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested on windows and linux (ubuntu 18)

Loading