4
4
// Here we generate the /dist files that allow widget embedding
5
5
6
6
var path = require ( 'path' ) ;
7
+ var webpack = require ( 'webpack' ) ;
7
8
8
9
var version = require ( './package.json' ) . version ;
9
10
@@ -60,6 +61,15 @@ var publicPath =
60
61
version +
61
62
'/dist/' ;
62
63
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
+
63
73
module . exports = [
64
74
{
65
75
// script that renders widgets using the standard embedding and can only render standard controls
@@ -72,6 +82,7 @@ module.exports = [
72
82
devtool : 'source-map' ,
73
83
module : { rules : rules } ,
74
84
mode : 'production' ,
85
+ plugins : plugins ,
75
86
} ,
76
87
{
77
88
// script that renders widgets using the amd embedding and can render third-party custom widgets
@@ -83,6 +94,7 @@ module.exports = [
83
94
} ,
84
95
module : { rules : rules } ,
85
96
mode : 'production' ,
97
+ plugins : plugins ,
86
98
} ,
87
99
{
88
100
// embed library that depends on requirejs, and can load third-party widgets dynamically
@@ -96,6 +108,7 @@ module.exports = [
96
108
} ,
97
109
module : { rules : rules } ,
98
110
mode : 'production' ,
111
+ plugins : plugins ,
99
112
} ,
100
113
{
101
114
// @jupyter -widgets/html-manager
@@ -110,6 +123,7 @@ module.exports = [
110
123
module : { rules : rules } ,
111
124
externals : [ '@jupyter-widgets/base' , '@jupyter-widgets/controls' ] ,
112
125
mode : 'production' ,
126
+ plugins : plugins ,
113
127
} ,
114
128
{
115
129
// @jupyter -widgets/base
@@ -123,6 +137,7 @@ module.exports = [
123
137
} ,
124
138
module : { rules : rules } ,
125
139
mode : 'production' ,
140
+ plugins : plugins ,
126
141
} ,
127
142
{
128
143
// @jupyter -widgets/controls
@@ -137,5 +152,6 @@ module.exports = [
137
152
module : { rules : rules } ,
138
153
externals : [ '@jupyter-widgets/base' ] ,
139
154
mode : 'production' ,
155
+ plugins : plugins ,
140
156
} ,
141
157
] ;
0 commit comments