File tree Expand file tree Collapse file tree 3 files changed +16
-4
lines changed
client/modules/IDE/components Expand file tree Collapse file tree 3 files changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -35,6 +35,7 @@ import {
3535} from '../actions/preferences' ;
3636import { setBlobUrl } from '../actions/files' ;
3737import { clearConsole , dispatchConsoleEvent } from '../actions/console' ;
38+ import getConfig from '../../../utils/getConfig' ;
3839
3940const shouldRenderSketch = ( props , prevProps = undefined ) => {
4041 const { isPlaying, previewIsRefreshing, fullView } = props ;
@@ -168,7 +169,7 @@ class PreviewFrame extends React.Component {
168169 }
169170
170171 const previewScripts = sketchDoc . createElement ( 'script' ) ;
171- previewScripts . src = '/previewScripts.js' ;
172+ previewScripts . src = getConfig ( 'PREVIEW_SCRIPTS_URL' ) ;
172173 sketchDoc . head . appendChild ( previewScripts ) ;
173174
174175 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() {
3434 window.process.env.UPLOAD_LIMIT = ${ process . env . UPLOAD_LIMIT ? `${ process . env . UPLOAD_LIMIT } ` : undefined } ;
3535 window.process.env.MOBILE_ENABLED = ${ process . env . MOBILE_ENABLED ? `${ process . env . MOBILE_ENABLED } ` : undefined } ;
3636 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' } ';
3838 </script>
3939 </head>
4040 <body>
Original file line number Diff line number Diff line change @@ -11,6 +11,8 @@ if (process.env.NODE_ENV === "development") {
1111 require ( 'dotenv' ) . config ( ) ;
1212}
1313
14+ const sharedObj = { } ;
15+
1416module . exports = [ {
1517 devtool : 'source-map' ,
1618 mode : 'production' ,
@@ -156,6 +158,8 @@ module.exports = [{
156158 plugins : [
157159 new WebpackManifestPlugin ( {
158160 basePath : '/' ,
161+ filename : 'manifest.json' ,
162+ seed : sharedObj
159163 } ) ,
160164 new MiniCssExtractPlugin ( {
161165 filename : 'app.[hash].css' ,
@@ -170,7 +174,7 @@ module.exports = [{
170174} ,
171175{
172176 entry : {
173- app : [
177+ previewScripts : [
174178 path . resolve ( __dirname , '../client/utils/previewEntry.js' )
175179 ]
176180 } ,
@@ -179,7 +183,7 @@ module.exports = [{
179183 mode : 'production' ,
180184 output : {
181185 path : path . resolve ( __dirname , '../dist/static' ) ,
182- filename : 'previewScripts.js' ,
186+ filename : 'previewScripts.[hash]. js' ,
183187 publicPath : '/'
184188 } ,
185189 resolve : {
@@ -208,4 +212,11 @@ module.exports = [{
208212 parallel : true
209213 } ) ] ,
210214 } ,
215+ plugins : [
216+ new WebpackManifestPlugin ( {
217+ basePath : '/' ,
218+ filename : 'manifest.json' ,
219+ seed : sharedObj
220+ } )
221+ ]
211222} ] ;
You can’t perform that action at this time.
0 commit comments