mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Add WS as a dep of notebooks (#8154)
* add ws as an optional dep of noteoboks * fix method of adding ws * fix parsing for yarnrc * remove optional reps
This commit is contained in:
@@ -8,13 +8,27 @@
|
||||
'use strict';
|
||||
|
||||
const withDefaults = require('../shared.webpack.config');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
const externals = {
|
||||
'node-fetch': 'commonjs node-fetch'
|
||||
};
|
||||
|
||||
// conditionally add ws if we are going to be running in a node environment
|
||||
const yarnrcPath = path.join(__dirname, '.yarnrc');
|
||||
if (fs.existsSync(yarnrcPath)) {
|
||||
const yarnrc = fs.readFileSync(yarnrcPath).toString();
|
||||
const properties = yarnrc.split(/\r?\n/).map(r => r.split(' '));
|
||||
if (properties.find(r => r[0] === 'runtime')[1] === '"node"') {
|
||||
externals['ws'] = 'commonjs ws';
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = withDefaults({
|
||||
context: __dirname,
|
||||
entry: {
|
||||
extension: './src/extension.ts'
|
||||
},
|
||||
externals: {
|
||||
'node-fetch': 'commonjs node-fetch'
|
||||
}
|
||||
externals: externals
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user