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 32
32
"tsc" : " yarn run -T tsc" ,
33
33
"jest" : " yarn run -T jest" ,
34
34
"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'" ,
36
36
"build" : " yarn clean && yarn build-prep && yarn concurrently 'NODE_ENV=production yarn umd' 'yarn pkg' 'yarn cjs'" ,
37
37
"release:cdn" : " yarn . build && NODE_ENV=production bash scripts/release.sh && NODE_ENV=stage bash scripts/release.sh" ,
38
38
"pkg" : " yarn tsc -p tsconfig.build.json" ,
Original file line number Diff line number Diff line change 1
1
import { getCDN , setGlobalCDNUrl } from '../lib/parse-cdn'
2
2
import { setVersionType } from '../lib/version-type'
3
3
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 ) {
6
6
// @ts -ignore
7
- __webpack_public_path__ = '/dist/umd/'
7
+ __webpack_public_path__ = process . env . ASSET_PATH
8
8
} else {
9
9
const cdn = getCDN ( )
10
- setGlobalCDNUrl ( cdn ) // preserving original behavior -- TODO: neccessary?
10
+ setGlobalCDNUrl ( cdn )
11
11
12
12
// @ts -ignore
13
13
__webpack_public_path__ = cdn + '/analytics-next/bundles/'
Original file line number Diff line number Diff line change 2
2
import { getCDN , setGlobalCDNUrl } from '../lib/parse-cdn'
3
3
import { setVersionType } from '../lib/version-type'
4
4
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 ) {
7
7
// @ts -ignore
8
- __webpack_public_path__ = '/dist/umd/'
8
+ __webpack_public_path__ = process . env . ASSET_PATH
9
9
} else {
10
10
const cdn = getCDN ( )
11
11
setGlobalCDNUrl ( cdn )
Original file line number Diff line number Diff line change @@ -7,15 +7,26 @@ const BundleAnalyzerPlugin =
7
7
const CircularDependencyPlugin = require ( 'circular-dependency-plugin' )
8
8
9
9
const 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
+ } )
13
26
14
27
const plugins = [
15
28
new CompressionPlugin ( { } ) ,
16
- new webpack . EnvironmentPlugin ( {
17
- ASSET_PATH ,
18
- } ) ,
29
+ new webpack . EnvironmentPlugin ( envPluginConfig ) ,
19
30
new CircularDependencyPlugin ( {
20
31
failOnError : true ,
21
32
} ) ,
Original file line number Diff line number Diff line change 7
7
"scripts" : {
8
8
"." : " yarn run -T turbo run --filter=@playground/standalone-playground..." ,
9
9
"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'" ,
11
11
"concurrently" : " yarn run -T concurrently"
12
12
},
13
13
"dependencies" : {
You can’t perform that action at this time.
0 commit comments