Skip to content

Commit

Permalink
fix: vscode extension fails to start due to canvas dependency being i…
Browse files Browse the repository at this point in the history
…ncorrectly required by jsdom
  • Loading branch information
Codeneos committed Sep 29, 2022
1 parent 8c6a031 commit 4b8d281
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
7 changes: 5 additions & 2 deletions packages/cli/webpack/webpack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ import * as packageJson from '../package.json';
const packageExternals = [
'vscode',
'vscode-languageclient',
'electron',
'canvas'
'electron'
];

const contextFolder = path.resolve(__dirname, '..');
Expand Down Expand Up @@ -102,6 +101,10 @@ const common : webpack.Configuration = {
},
plugins: [
new WatchMarkersPlugin(),
new webpack.IgnorePlugin({
resourceRegExp: /^canvas$/,
contextRegExp: /jsdom$/,
}),
new webpack.DefinePlugin({
__webpack_build_info__: JSON.stringify({
version: packageJson.version,
Expand Down
11 changes: 7 additions & 4 deletions packages/vscode-extension/webpack/webpack.common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ const packageExternals = [
// VSCode is an external that we do not want to package
'vscode',
'vscode-languageclient',
'electron',
'canvas'
'electron'
];

const contextFolder = path.resolve(__dirname, '..');
Expand Down Expand Up @@ -98,7 +97,11 @@ const common : webpack.Configuration = {
devtoolModuleFilenameTemplate: '[absolute-resource-path]'
},
plugins: [
new WatchMarkersPlugin()
new WatchMarkersPlugin(),
new webpack.IgnorePlugin({
resourceRegExp: /^canvas$/,
contextRegExp: /jsdom$/,
})
],
node: {
__dirname: false,
Expand Down Expand Up @@ -162,7 +165,7 @@ const common : webpack.Configuration = {
externals: function({ request }, callback) {
const isExternal = packageExternals.some(
moduleName => request && new RegExp(`^${moduleName}(/|$)`, 'i').test(request)
);
)
if (isExternal){
// @ts-ignore
return callback(undefined, `commonjs ${request}`);
Expand Down

0 comments on commit 4b8d281

Please sign in to comment.