Skip to content
This repository was archived by the owner on Jun 3, 2024. It is now read-only.

Commit 6d6e5af

Browse files
committed
Add dev_bundle support.
1 parent 96e54cc commit 6d6e5af

File tree

5 files changed

+13147
-40
lines changed

5 files changed

+13147
-40
lines changed

dash_core_components/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
'https://unpkg.com/dash-core-components@{}'
4646
'/dash_core_components/bundle.js'
4747
).format(__version__),
48+
'dev_package_path': 'bundle.dev.js',
4849
'namespace': 'dash_core_components'
4950
}
5051
]

dash_core_components/bundle.dev.js

Lines changed: 13107 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dash_core_components/bundle.js.map

Lines changed: 0 additions & 1 deletion
This file was deleted.

package.json

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,18 @@
88
},
99
"main": "src/index.js",
1010
"scripts": {
11-
"build-dev": "builder run clean-lib && builder run extract-metadata && builder run generate-python-classes && webpack -w --config=./config/webpack/webpack.config.dev.js",
12-
"build-dist": "builder run clean-lib && builder run extract-metadata && builder run generate-python-classes && cross-env NODE_ENV=production webpack --config=./config/webpack/webpack.config.dist.js",
13-
"copy-lib": "cp -f lib/* dash_core_components",
1411
"generate-python-classes": "python -c \"import dash; dash.development.component_loader.generate_classes('dash_core_components', 'dash_core_components/metadata.json');\"",
1512
"install-local": "npm run copy-lib && python setup.py install",
16-
"prepublish": "npm test && builder run build-dist && npm run copy-lib",
13+
"prepublish": "npm test && npm run build:js && npm run build:py",
1714
"publish-all": "npm publish && python setup.py sdist upload",
1815
"publish-pypi": "npm run prepublish && python setup.py sdist && twine upload --sign --skip-existing",
19-
"start": "./node_modules/.bin/builder run build-dev",
16+
"start": "webpack-serve ./webpack.serve.config.js --open",
2017
"test": "eslint src",
2118
"test-watch": "./node_modules/.bin/builder run test-frontend-watch",
2219
"test-debug": "./node_modules/.bin/builder run test-frontend-debug",
2320
"uninstall-local": "pip uninstall dash-core-components -y",
2421
"build:js": "webpack --mode production",
22+
"build:js-dev": "webpack --mode development",
2523
"build:py": "node ./extract-meta src/components > dash_core_components/metadata.json && cp package.json dash_core_components && npm run generate-python-classes"
2624
},
2725
"author": "Chris Parmer <[email protected]>",

webpack.config.js

Lines changed: 36 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -3,39 +3,41 @@ const packagejson = require('./package.json');
33

44
const dashLibraryName = packagejson.name.replace(/-/g, '_');
55

6-
module.exports = {
7-
entry: {main: './src/index.js'},
8-
output: {
9-
path: path.resolve(__dirname, dashLibraryName),
10-
filename: 'bundle.js',
11-
library: dashLibraryName,
12-
libraryTarget: 'window'
13-
},
14-
externals: {
15-
react: 'React',
16-
'react-dom': 'ReactDOM',
17-
'plotly.js': 'Plotly'
18-
},
19-
module: {
20-
rules: [
21-
{
22-
test: /\.js$/,
23-
exclude: /node_modules/,
24-
use: {
25-
loader: 'babel-loader'
26-
}
27-
},
28-
{
29-
test: /\.css$/,
30-
use: [
31-
{
32-
loader: 'style-loader'
33-
},
34-
{
35-
loader: 'css-loader'
6+
module.exports = (env, argv) => {
7+
return {
8+
entry: {main: './src/index.js'},
9+
output: {
10+
path: path.resolve(__dirname, dashLibraryName),
11+
filename: argv.mode === 'development' ? 'bundle.dev.js' : 'bundle.js',
12+
library: dashLibraryName,
13+
libraryTarget: 'window'
14+
},
15+
externals: {
16+
react: 'React',
17+
'react-dom': 'ReactDOM',
18+
'plotly.js': 'Plotly'
19+
},
20+
module: {
21+
rules: [
22+
{
23+
test: /\.js$/,
24+
exclude: /node_modules/,
25+
use: {
26+
loader: 'babel-loader'
3627
}
37-
]
38-
}
39-
]
40-
}
28+
},
29+
{
30+
test: /\.css$/,
31+
use: [
32+
{
33+
loader: 'style-loader'
34+
},
35+
{
36+
loader: 'css-loader'
37+
}
38+
]
39+
}
40+
]
41+
}
42+
};
4143
};

0 commit comments

Comments
 (0)