/
webpack.config.js
53 lines (48 loc) · 1.32 KB
/
webpack.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
const fs = require("fs")
const path = require("path")
const {name, version} = require("./package.json")
const metadata = JSON.stringify({name, version})
fs.writeFileSync("./lib/metadata.js", `Object.assign(exports, ${metadata})`)
const externals = [/^@jupyterlab\/.+$/]
module.exports = [
/**
* Notebook extension
*
* This bundle only contains the part of the JavaScript that is run on load of
* the notebook.
*/
{
entry: "./lib/extension.js",
output: {
filename: "index.js",
path: path.resolve(__dirname, "jupyter_bokeh", "nbextension"),
libraryTarget: "amd",
},
externals,
devtool: "source-map",
performance: {hints: false},
},
/**
* Embeddable bundle
*
* This bundle is almost identical to the notebook extension bundle. The only
* difference is in the configuration of the webpack public path for the
* static assets.
*
* The target bundle is always `dist/index.js`, which is the path required by
* the custom widget embedder.
*/
{
entry: "./lib/index.js",
output: {
filename: "index.js",
path: path.resolve(__dirname, "dist"),
libraryTarget: "amd",
library: name,
publicPath: `https://unpkg.com/${name}@${version}/dist/`,
},
externals,
devtool: "source-map",
performance: {hints: false},
},
]