Skip to content

Commit bb0ef2d

Browse files
committed
Attempt to fixing docs's "process is not defined" issue
1 parent c7bd329 commit bb0ef2d

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

packages/html-manager/webpack.config.js

+16
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
// Here we generate the /dist files that allow widget embedding
55

66
var path = require('path');
7+
var webpack = require('webpack');
78

89
var version = require('./package.json').version;
910

@@ -60,6 +61,15 @@ var publicPath =
6061
version +
6162
'/dist/';
6263

64+
var plugins = [
65+
new webpack.DefinePlugin({
66+
// Needed for Blueprint. See https://github.com/palantir/blueprint/issues/4393
67+
'process.env': '{}',
68+
// Needed for various packages using cwd(), like the path polyfill
69+
process: { cwd: () => '/' },
70+
}),
71+
];
72+
6373
module.exports = [
6474
{
6575
// script that renders widgets using the standard embedding and can only render standard controls
@@ -72,6 +82,7 @@ module.exports = [
7282
devtool: 'source-map',
7383
module: { rules: rules },
7484
mode: 'production',
85+
plugins: plugins,
7586
},
7687
{
7788
// script that renders widgets using the amd embedding and can render third-party custom widgets
@@ -83,6 +94,7 @@ module.exports = [
8394
},
8495
module: { rules: rules },
8596
mode: 'production',
97+
plugins: plugins,
8698
},
8799
{
88100
// embed library that depends on requirejs, and can load third-party widgets dynamically
@@ -96,6 +108,7 @@ module.exports = [
96108
},
97109
module: { rules: rules },
98110
mode: 'production',
111+
plugins: plugins,
99112
},
100113
{
101114
// @jupyter-widgets/html-manager
@@ -110,6 +123,7 @@ module.exports = [
110123
module: { rules: rules },
111124
externals: ['@jupyter-widgets/base', '@jupyter-widgets/controls'],
112125
mode: 'production',
126+
plugins: plugins,
113127
},
114128
{
115129
// @jupyter-widgets/base
@@ -123,6 +137,7 @@ module.exports = [
123137
},
124138
module: { rules: rules },
125139
mode: 'production',
140+
plugins: plugins,
126141
},
127142
{
128143
// @jupyter-widgets/controls
@@ -137,5 +152,6 @@ module.exports = [
137152
module: { rules: rules },
138153
externals: ['@jupyter-widgets/base'],
139154
mode: 'production',
155+
plugins: plugins,
140156
},
141157
];

0 commit comments

Comments
 (0)