Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
54 lines (50 loc) · 1.5 KB

File metadata and controls

54 lines (50 loc) · 1.5 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
54
BUNDLE_CONFIG = \
"""
var resolve = require('{path_to_resolve}');
module.exports = {{
context: '{dir}',
entry: '{file}',
output: {{
path: '[bundle_dir]/react-components',
filename: '{var}-[hash].js',
libraryTarget: 'umd',
library: '{var}'
}},
externals: [{{
react: {{
commonjs2: resolve.sync('react', {{basedir: '{dir}'}}),
root: 'React'
}},
'react/addons': {{
commonjs2: resolve.sync('react/addons', {{basedir: '{dir}'}}),
root: 'React'
}}
}}]{dev_tool_config}{translate_config}
}};
"""
DEV_TOOL_CONFIG = """,\n devtool: 'eval'"""
BUNDLE_TRANSLATE_CONFIG = \
""",
module: {{
loaders: [{{
test: /\{ext}$/,
exclude: /node_modules/,
loader: 'babel-loader'
}}]
}},
resolveLoader: {{
root: '{node_modules}'
}}
"""
MOUNT_JS = \
"""
if (typeof React === 'undefined') throw new Error('Cannot find `React` global variable. Have you added a script element to this page which points to React?');
if (typeof {var} === 'undefined') throw new Error('Cannot find component variable `{var}`');
(function(React, component, containerId) {{
var props = {props};
var element = React.createElement(component, props);
var container = document.getElementById(containerId);
if (!container) throw new Error('Cannot find the container element `#{container_id}` for component `{var}`');
React.render(element, container);
}})(React, {var}, '{container_id}');
"""
Morty Proxy This is a proxified and sanitized view of the page, visit original site.