@@ -8,6 +8,18 @@ const createHash = require('crypto').createHash;
88// const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
99const PoLoaderOptimizer = require ( 'webpack-i18n-tools' ) ( ) ;
1010
11+ let coreVersion = '' ;
12+ try {
13+ // Will fail until @nimiq /core export map is updated to also make the package.json file available
14+ coreVersion = require ( '@nimiq/core/package.json' ) . version ;
15+ } catch ( e ) {
16+ // Fallback to reading the package.json file directly
17+ pkgJson = require ( 'fs' ) . readFileSync ( path . join ( __dirname , 'node_modules/@nimiq/core/package.json' ) ) ;
18+ coreVersion = JSON . parse ( pkgJson ) . version ;
19+ }
20+
21+ if ( ! coreVersion ) throw new Error ( 'Could not determine @nimiq/core version' ) ;
22+
1123const crypto = require ( 'crypto' ) ;
1224
1325// Fix build for Node version with OpenSSL 3
@@ -28,8 +40,6 @@ const domain = buildName === 'mainnet'
2840 ? process . env . VUE_APP_HUB_URL
2941 : 'http://localhost:8080' ;
3042
31- const cdnDomain = 'https://cdn.nimiq-testnet.com' ;
32-
3343const browserWarningTemplate = fs . readFileSync (
3444 path . join ( __dirname , 'node_modules/@nimiq/browser-warning/dist/browser-warning.html.template' ) ) ;
3545
@@ -73,7 +83,7 @@ const configureWebpack = {
7383 } ,
7484 {
7585 from : 'node_modules/@nimiq/core' ,
76- to : './albatross-client/' ,
86+ to : `./nimiq/v ${ coreVersion } /` ,
7787 } ,
7888 ] } ) ,
7989 new WriteFileWebpackPlugin ( ) ,
@@ -130,7 +140,7 @@ const pages = {
130140 browserWarningTemplate,
131141 browserWarningIntegrityHash,
132142 domain,
133- cdnDomain ,
143+ coreVersion ,
134144 // output as dist/index.html
135145 filename : 'index.html' ,
136146 // chunks to include on this page, by default includes
@@ -142,6 +152,7 @@ const pages = {
142152 entry : 'src/iframe.ts' ,
143153 // the source template
144154 template : 'public/iframe.html' ,
155+ coreVersion,
145156 // output as dist/iframe.html
146157 filename : 'iframe.html' ,
147158 // chunks to include on this page, by default includes
@@ -157,7 +168,7 @@ const pages = {
157168 browserWarningTemplate,
158169 browserWarningIntegrityHash,
159170 domain,
160- cdnDomain ,
171+ coreVersion ,
161172 // output as dist/cashlink/index.html
162173 filename : 'cashlink/index.html' ,
163174 // chunks to include on this page, by default includes
@@ -169,7 +180,7 @@ const pages = {
169180 entry : 'src/export.ts' ,
170181 // the source template
171182 template : 'public/export.html' ,
172- cdnDomain ,
183+ coreVersion ,
173184 // output as dist/iframe.html
174185 filename : 'export.html' ,
175186 } ,
@@ -181,7 +192,7 @@ if (buildName === 'local' || buildName === 'testnet') {
181192 entry : 'demos/Demo.ts' ,
182193 // the source template
183194 template : 'demos/index.html' ,
184- cdnDomain ,
195+ coreVersion ,
185196 bitcoinJsIntegrityHash,
186197 // output as dist/demos.html
187198 filename : 'demos.html' ,
0 commit comments