mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2025-03-22 19:05:56 -04:00
Remove ./src/environment from Webpack config and bind environment to window. Resolves GH-199.
This commit is contained in:
parent
0bfd6e1430
commit
06de644ae6
5 changed files with 12 additions and 19 deletions
|
@ -28,10 +28,15 @@
|
|||
<link rel="shortcut icon" href="/favicon.ico" />
|
||||
<link rel="stylesheet" href="/css/lib/normalize.min.css" />
|
||||
|
||||
<!-- Polyfill -->
|
||||
<script src="/js/lib/polyfill.min.js"></script>
|
||||
<!-- Environment -->
|
||||
<script>
|
||||
window.env = {
|
||||
API_HOST: "{{&api_host}}"
|
||||
};
|
||||
</script>
|
||||
|
||||
<!-- Initialize (Session & Localization) -->
|
||||
<!-- Polyfill & Initialize (Session & Localization)-->
|
||||
<script src="/js/lib/polyfill.min.js"></script>
|
||||
<script src="/js/init.bundle.js"></script>
|
||||
</head>
|
||||
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
var Environment = {
|
||||
NODE_ENV: JSON.stringify(process.env.NODE_ENV || 'development'),
|
||||
API_HOST: JSON.stringify(process.env.API_HOST || 'https://api-staging.scratch.mit.edu')
|
||||
};
|
||||
|
||||
module.exports = Environment;
|
|
@ -15,11 +15,9 @@ var render = function (jsx, element) {
|
|||
element
|
||||
);
|
||||
|
||||
// If in production, provide list of rendered components
|
||||
if (process.env.NODE_ENV != 'production') {
|
||||
window._renderedComponents = window._renderedComponents || [];
|
||||
window._renderedComponents.push(component);
|
||||
}
|
||||
// Provide list of rendered components
|
||||
window._renderedComponents = window._renderedComponents || [];
|
||||
window._renderedComponents.push(component);
|
||||
};
|
||||
|
||||
module.exports = render;
|
||||
|
|
|
@ -13,7 +13,7 @@ var Api = {
|
|||
],
|
||||
api: function (opts, callback) {
|
||||
defaults(opts, {
|
||||
host: process.env.API_HOST,
|
||||
host: window.env.API_HOST,
|
||||
headers: {},
|
||||
json: {},
|
||||
useCsrf: false
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
var path = require('path');
|
||||
var webpack = require('webpack');
|
||||
|
||||
var environment = require('./src/environment.js');
|
||||
var routes = require('./server/routes.json');
|
||||
|
||||
// Prepare all entry points
|
||||
|
@ -53,9 +52,6 @@ module.exports = {
|
|||
fs: 'empty'
|
||||
},
|
||||
plugins: [
|
||||
new webpack.DefinePlugin({
|
||||
'process.env': environment
|
||||
}),
|
||||
new webpack.optimize.UglifyJsPlugin({
|
||||
compress: {
|
||||
warnings: false
|
||||
|
|
Loading…
Reference in a new issue