@@ -6,6 +6,8 @@ const rules = [
6
6
7
7
// Packages that shouldn't be bundled but loaded at runtime
8
8
const externals = [ '@jupyter-widgets/base' , 'three' , 'jupyter-threejs' ] ;
9
+ var version = require ( './package.json' ) . version ;
10
+ var path = require ( 'path' ) ;
9
11
10
12
module . exports = [
11
13
{
@@ -46,4 +48,36 @@ module.exports = [
46
48
extensions : [ ".webpack.js" , ".web.js" , ".ts" , ".js" ]
47
49
} ,
48
50
} ,
51
+ { // Embeddable {{ cookiecutter.npm_package_name }} bundle
52
+ //
53
+ // This bundle is generally almost identical to the notebook bundle
54
+ // containing the custom widget views and models.
55
+ //
56
+ // The only difference is in the configuration of the webpack public path
57
+ // for the static assets.
58
+ //
59
+ // It will be automatically distributed by unpkg to work with the static
60
+ // widget embedder.
61
+ //
62
+ // The target bundle is always `dist/index.js`, which is the path required
63
+ // by the custom widget embedder.
64
+ //
65
+ entry : './src/index.ts' ,
66
+ output : {
67
+ filename : 'index.js' ,
68
+ path : path . resolve ( __dirname , 'dist' ) ,
69
+ libraryTarget : 'amd' ,
70
+ library : "{{ cookiecutter.npm_package_name }}" ,
71
+ publicPath : 'https://unpkg.com/{{ cookiecutter.npm_package_name }}@' + version + '/dist/'
72
+ } ,
73
+ devtool : 'source-map' ,
74
+ module : {
75
+ rules : rules
76
+ } ,
77
+ externals : [ '@jupyter-widgets/base' ] ,
78
+ resolve : {
79
+ // Add '.ts' and '.tsx' as resolvable extensions.
80
+ extensions : [ ".webpack.js" , ".web.js" , ".ts" , ".js" ]
81
+ } ,
82
+ }
49
83
] ;
0 commit comments