File tree 3 files changed +16
-4
lines changed
client/modules/IDE/components
3 files changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -35,6 +35,7 @@ import {
35
35
} from '../actions/preferences' ;
36
36
import { setBlobUrl } from '../actions/files' ;
37
37
import { clearConsole , dispatchConsoleEvent } from '../actions/console' ;
38
+ import getConfig from '../../../utils/getConfig' ;
38
39
39
40
const shouldRenderSketch = ( props , prevProps = undefined ) => {
40
41
const { isPlaying, previewIsRefreshing, fullView } = props ;
@@ -168,7 +169,7 @@ class PreviewFrame extends React.Component {
168
169
}
169
170
170
171
const previewScripts = sketchDoc . createElement ( 'script' ) ;
171
- previewScripts . src = '/previewScripts.js' ;
172
+ previewScripts . src = getConfig ( 'PREVIEW_SCRIPTS_URL' ) ;
172
173
sketchDoc . head . appendChild ( previewScripts ) ;
173
174
174
175
const sketchDocString = `<!DOCTYPE HTML>\n${ sketchDoc . documentElement . outerHTML } ` ;
Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ export function renderIndex() {
34
34
window.process.env.UPLOAD_LIMIT = ${ process . env . UPLOAD_LIMIT ? `${ process . env . UPLOAD_LIMIT } ` : undefined } ;
35
35
window.process.env.MOBILE_ENABLED = ${ process . env . MOBILE_ENABLED ? `${ process . env . MOBILE_ENABLED } ` : undefined } ;
36
36
window.process.env.TRANSLATIONS_ENABLED = ${ process . env . TRANSLATIONS_ENABLED === 'true' ? true : false } ;
37
-
37
+ window.process.env.PREVIEW_SCRIPTS_URL = ' ${ process . env . NODE_ENV === 'production' ? ` ${ assetsManifest [ '/previewScripts.js' ] } ` : '/previewScripts.js' } ';
38
38
</script>
39
39
</head>
40
40
<body>
Original file line number Diff line number Diff line change @@ -11,6 +11,8 @@ if (process.env.NODE_ENV === "development") {
11
11
require ( 'dotenv' ) . config ( ) ;
12
12
}
13
13
14
+ const sharedObj = { } ;
15
+
14
16
module . exports = [ {
15
17
devtool : 'source-map' ,
16
18
mode : 'production' ,
@@ -156,6 +158,8 @@ module.exports = [{
156
158
plugins : [
157
159
new WebpackManifestPlugin ( {
158
160
basePath : '/' ,
161
+ filename : 'manifest.json' ,
162
+ seed : sharedObj
159
163
} ) ,
160
164
new MiniCssExtractPlugin ( {
161
165
filename : 'app.[hash].css' ,
@@ -170,7 +174,7 @@ module.exports = [{
170
174
} ,
171
175
{
172
176
entry : {
173
- app : [
177
+ previewScripts : [
174
178
path . resolve ( __dirname , '../client/utils/previewEntry.js' )
175
179
]
176
180
} ,
@@ -179,7 +183,7 @@ module.exports = [{
179
183
mode : 'production' ,
180
184
output : {
181
185
path : path . resolve ( __dirname , '../dist/static' ) ,
182
- filename : 'previewScripts.js' ,
186
+ filename : 'previewScripts.[hash]. js' ,
183
187
publicPath : '/'
184
188
} ,
185
189
resolve : {
@@ -208,4 +212,11 @@ module.exports = [{
208
212
parallel : true
209
213
} ) ] ,
210
214
} ,
215
+ plugins : [
216
+ new WebpackManifestPlugin ( {
217
+ basePath : '/' ,
218
+ filename : 'manifest.json' ,
219
+ seed : sharedObj
220
+ } )
221
+ ]
211
222
} ] ;
You can’t perform that action at this time.
0 commit comments