File tree Expand file tree Collapse file tree 6 files changed +31
-15
lines changed
playgrounds/standalone-playground Expand file tree Collapse file tree 6 files changed +31
-15
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ ' @segment/analytics-next ' : patch
3+ ---
4+
5+ Update init to allow for asset path overriding and fix debugging experience
Original file line number Diff line number Diff line change 3232 "tsc" : " yarn run -T tsc" ,
3333 "jest" : " yarn run -T jest" ,
3434 "concurrently" : " yarn run -T concurrently" ,
35- "watch" : " yarn concurrently 'NODE_ENV=production WATCH=true yarn umd --watch' 'yarn pkg --watch'" ,
35+ "watch" : " yarn concurrently 'WATCH=true yarn umd --watch' 'yarn pkg --watch'" ,
3636 "build" : " yarn clean && yarn build-prep && yarn concurrently 'NODE_ENV=production yarn umd' 'yarn pkg' 'yarn cjs'" ,
3737 "release:cdn" : " yarn . build && NODE_ENV=production bash scripts/release.sh && NODE_ENV=stage bash scripts/release.sh" ,
3838 "pkg" : " yarn tsc -p tsconfig.build.json" ,
Original file line number Diff line number Diff line change 11import { getCDN , setGlobalCDNUrl } from '../lib/parse-cdn'
22import { setVersionType } from '../lib/version-type'
33
4- if ( process . env . ASSET_PATH ) {
5- if ( process . env . ASSET_PATH === '/dist/umd/' ) {
4+ if ( process . env . IS_WEBPACK_BUILD ) {
5+ if ( process . env . ASSET_PATH ) {
66 // @ts -ignore
7- __webpack_public_path__ = '/dist/umd/'
7+ __webpack_public_path__ = process . env . ASSET_PATH
88 } else {
99 const cdn = getCDN ( )
10- setGlobalCDNUrl ( cdn ) // preserving original behavior -- TODO: neccessary?
10+ setGlobalCDNUrl ( cdn )
1111
1212 // @ts -ignore
1313 __webpack_public_path__ = cdn + '/analytics-next/bundles/'
Original file line number Diff line number Diff line change 22import { getCDN , setGlobalCDNUrl } from '../lib/parse-cdn'
33import { setVersionType } from '../lib/version-type'
44
5- if ( process . env . ASSET_PATH ) {
6- if ( process . env . ASSET_PATH === '/dist/umd/' ) {
5+ if ( process . env . IS_WEBPACK_BUILD ) {
6+ if ( process . env . ASSET_PATH ) {
77 // @ts -ignore
8- __webpack_public_path__ = '/dist/umd/'
8+ __webpack_public_path__ = process . env . ASSET_PATH
99 } else {
1010 const cdn = getCDN ( )
1111 setGlobalCDNUrl ( cdn )
Original file line number Diff line number Diff line change @@ -7,15 +7,26 @@ const BundleAnalyzerPlugin =
77const CircularDependencyPlugin = require ( 'circular-dependency-plugin' )
88
99const isProd = process . env . NODE_ENV === 'production'
10- const ASSET_PATH = isProd
11- ? 'https://cdn.segment.com/analytics-next/bundles/'
12- : '/dist/umd/'
10+
11+ const ASSET_PATH = process . env . ASSET_PATH
12+ ? process . env . ASSET_PATH
13+ : ! isProd
14+ ? '/dist/umd/'
15+ : ''
16+
17+ const envPluginConfig = {
18+ ASSET_PATH : ASSET_PATH ,
19+ IS_WEBPACK_BUILD : true ,
20+ }
21+
22+ console . log ( 'Running Webpack Build' , {
23+ NODE_ENV : process . env . NODE_ENV ,
24+ 'Webpack Environment Plugin' : envPluginConfig ,
25+ } )
1326
1427const plugins = [
1528 new CompressionPlugin ( { } ) ,
16- new webpack . EnvironmentPlugin ( {
17- ASSET_PATH ,
18- } ) ,
29+ new webpack . EnvironmentPlugin ( envPluginConfig ) ,
1930 new CircularDependencyPlugin ( {
2031 failOnError : true ,
2132 } ) ,
Original file line number Diff line number Diff line change 77 "scripts" : {
88 "." : " yarn run -T turbo run --filter=@playground/standalone-playground..." ,
99 "start" : " yarn http-server . -o /pages" ,
10- "dev" : " yarn concurrently 'yarn . build && yarn start' 'sleep 10 && yarn . watch'" ,
10+ "dev" : " yarn concurrently 'yarn start' 'sleep 3 && ASSET_PATH='/node_modules/@segment/analytics-next/dist/umd/' yarn . watch'" ,
1111 "concurrently" : " yarn run -T concurrently"
1212 },
1313 "dependencies" : {
You can’t perform that action at this time.
0 commit comments