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

Issue 104 - Add source map to NPM and PyPi packages #105

Merged
merged 4 commits into from
Dec 7, 2018
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

## [0.15.2] - 2018-12-06
### Added
- Source map [#104](https://github.com/plotly/dash-renderer/issues/104)
Related Dash issue [#480](https://github.com/plotly/dash/issues/480)


## [0.15.1] - 2018-11-17
### Fixed
- Fix a bug in the ON_PROP_CHANGE callback where history was not correctly set when acting on more than one component. In particular, the 'undo' button should now work as expected. Fixes [#66](https://github.com/plotly/dash-renderer/issues/66).
Expand Down
4 changes: 3 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
include dash_renderer/dash_renderer.min.js
include dash_renderer/dash_renderer.dev.js
include dash_renderer/dash_renderer.dev.js.map
include dash_renderer/dash_renderer.min.js
include dash_renderer/dash_renderer.min.js.map
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding map files, reordering

include dash_renderer/react-dom@*.min.js
include dash_renderer/react@*.min.js
9 changes: 9 additions & 0 deletions dash_renderer/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,5 +80,14 @@ def _set_react_version(react_version):
'/dash_renderer/dash_renderer.min.js'
).format(__version__),
'namespace': 'dash_renderer'
},
{
'relative_package_path': '{}.min.js.map'.format(__name__),
'dev_package_path': '{}.dev.js.map'.format(__name__),
"external_url": (
'https://unpkg.com/dash-renderer@{}'
'/dash_renderer/dash_renderer.min.js.map'
).format(__version__),
'namespace': 'dash_renderer'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add maps to Dash

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure it needs an entry here for the map, the _js_dist are files automatically served on the index. I think the js bundle will request the map on it's own.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right that the JS file will request it on its own if the dev tools are opened -- but it will resolve it to its relative path, for example
image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or will Dash still allow the request to go through even if it's not defined here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In any case, I'll try it -- I assumed it was necessary :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes dash should allow it, before the map changes in dash I remember seeing 500 errors for map requests.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested it out against the dash-table's examples and if the map is not present here, it doesn't get loaded. Dash probably tells the browser there is no such resource; and the browser continues on with its life?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So it seems this additional entry is required

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but the 500 only happens if there is no extension support for map and the map is in the init file

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah your right just looked at the code and we check the if the path is registered so it needs to be in the dist for dash to allow it.

}
]
30,285 changes: 29,520 additions & 765 deletions dash_renderer/dash_renderer.dev.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dash_renderer/dash_renderer.dev.js.map

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions dash_renderer/dash_renderer.min.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dash_renderer/dash_renderer.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dash_renderer/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '0.15.1'
__version__ = '0.15.2'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bump version

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dash-renderer",
"version": "0.15.0",
"version": "0.15.2",
Copy link
Contributor Author

@Marc-Andre-Rivet Marc-Andre-Rivet Dec 6, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bump version.. for some reason this had not been bumped to 0.15.1 for NPM

"description": "render dash components in react",
"main": "src/index.js",
"scripts": {
Expand Down
4 changes: 2 additions & 2 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ module.exports = (env, argv) => {
library: dashLibraryName,
libraryTarget: 'window',
},
devtool: 'source-map',
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Source map! This setting is slower but more accurate than other mappings. See here: https://webpack.js.org/configuration/devtool/

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to be sure I don't lose my debugging support with this, I remember the plain source-maps did not work so well.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the in-IDE support you mentioned to me a little while ago?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I'll try it to be sure.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. If it doesn't work I'll change it to:
mode === 'development' ? 'eval-source-map' : 'source-map'
which will give you the old behavior in dev

externals: {
react: 'React',
'react-dom': 'ReactDOM',
Expand All @@ -57,7 +58,6 @@ module.exports = (env, argv) => {
],
},
],
},
devtool: mode === 'development' ? 'eval-source-map' : 'none',
}
};
};