Skip to content

Commit

Permalink
[BUG] Snippet initialization with IE8/9 fails with minified code (wor…
Browse files Browse the repository at this point in the history
…ks with un-minified code) #1852
  • Loading branch information
MSNev committed Jun 14, 2022
1 parent 796caa3 commit ae2e478
Show file tree
Hide file tree
Showing 24 changed files with 551 additions and 393 deletions.
6 changes: 6 additions & 0 deletions AISKU/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,15 @@ const browserRollupConfigFactory = (isProduction, libVersion = '2', format = 'um
browserRollupConfig.plugins.push(
uglify({
ie8: true,
ie: true,
toplevel: true,
compress: {
ie: true,
passes:3,
unsafe: true
},
output: {
ie: true,
preamble: banner,
webkit:true
}
Expand Down Expand Up @@ -128,12 +131,15 @@ const nodeUmdRollupConfigFactory = (isProduction) => {
nodeRollupConfig.plugins.push(
uglify({
ie8: true,
ie: true,
toplevel: true,
compress: {
ie: true,
passes:3,
unsafe: true
},
output: {
ie: true,
preamble: banner,
webkit:true
}
Expand Down
4 changes: 2 additions & 2 deletions AISKU/src/ApplicationInsightsContainer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export class ApplicationInsightsContainer {

public static getAppInsights(snippet: Snippet, version: number) : IApplicationInsights | IAppInsightsDeprecated {
const initialization = new ApplicationInsights(snippet);
const legacyMode = version !== 2.0 ? true : false;
const legacyMode = version >= 2 ? false: true;

// Side effect is to create, initialize and listen to the CoreUtils._canUseCookies changes
// Called here to support backward compatibility
Expand All @@ -17,7 +17,7 @@ export class ApplicationInsightsContainer {
// 2. Customer updates to new snippet (that uses cdn location to new SDK. This is same as a new customer onboarding
// and all api signatures are expected to map to new SDK. Note new snippet specifies version

if (version === 2.0) {
if (!legacyMode) {
initialization.updateSnippetDefinitions(snippet);
initialization.loadAppInsights(legacyMode);
return initialization; // default behavior with new snippet
Expand Down
2 changes: 1 addition & 1 deletion AISKU/src/Init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ try {

// overwrite snippet with full appInsights
// only initiaize if required and detected snippet version is >= 2 or not defined
if ((snippet.version >= 2.0 && (_window[aiName] as any).initialize) || snippet.version === undefined ) {
if ((snippet.version >= 2 && (_window[aiName] as any).initialize) || snippet.version === undefined ) {
ApplicationInsightsContainer.getAppInsights(snippet, snippet.version);
}
}
Expand Down
6 changes: 6 additions & 0 deletions AISKULight/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,15 @@ const browserRollupConfigFactory = (isProduction, libV = '2') => {
browserRollupConfig.plugins.push(
uglify({
ie8: true,
ie: true,
toplevel: true,
compress: {
ie: true,
passes:3,
unsafe: true
},
output: {
ie: true,
preamble: banner,
webkit:true
}
Expand Down Expand Up @@ -114,12 +117,15 @@ const nodeUmdRollupConfigFactory = (isProduction) => {
nodeRollupConfig.plugins.push(
uglify({
ie8: true,
ie: true,
toplevel: true,
compress: {
ie: true,
passes:3,
unsafe: true
},
output: {
ie: true,
preamble: banner,
webkit:true
}
Expand Down
6 changes: 6 additions & 0 deletions channels/applicationinsights-channel-js/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,15 @@ const browserRollupConfigFactory = isProduction => {
browserRollupConfig.plugins.push(
uglify({
ie8: true,
ie: true,
toplevel: true,
compress: {
ie: true,
passes:3,
unsafe: true
},
output: {
ie: true,
preamble: banner,
webkit:true
}
Expand Down Expand Up @@ -113,12 +116,15 @@ const nodeUmdRollupConfigFactory = (isProduction) => {
nodeRollupConfig.plugins.push(
uglify({
ie8: true,
ie: true,
toplevel: true,
compress: {
ie: true,
passes:3,
unsafe: true
},
output: {
ie: true,
preamble: banner,
webkit:true
}
Expand Down
Loading

0 comments on commit ae2e478

Please sign in to comment.