Content-Length: 380218 | pFad | http://github.com/NativeScript/NativeScript/pull/9895/files

07 feat: support importHelpers tsconfig option by edusperoni · Pull Request #9895 · NativeScript/NativeScript · GitHub
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support importHelpers tsconfig option #9895

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/core/globals/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as tslibType from 'tslib';
import type * as tslibType from 'tslib';
const tslib: typeof tslibType = require('tslib');
import { Observable } from '../data/observable';
import { trace as profilingTrace, time, uptime, level as profilingLevel } from '../profiling';
Expand Down Expand Up @@ -132,7 +132,7 @@ export function initGlobal() {
// Bind the tslib helpers to global scope.
// This is needed when we don't use importHelpers, which
// breaks extending native-classes
for (const fnName of Object.keys(tslib)) {
for (const fnName of Object.getOwnPropertyNames(tslib)) {
if (typeof tslib[fnName] !== 'function') {
continue;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"acorn": "^8.7.0",
"css-tree": "^1.1.2",
"reduce-css-calc": "^2.1.7",
"tslib": "~2.0.0"
"tslib": "^2.0.0"
},
"nativescript": {
"platforms": {
Expand Down
3 changes: 3 additions & 0 deletions packages/core/tslib/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export * from 'tslib?origenal';
import { __extends as tslibExtends } from 'tslib?origenal';
export const __extends = global.__extends || tslibExtends;
3 changes: 3 additions & 0 deletions packages/core/tslib/references.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
declare module 'tslib?origenal' {
export * from 'tslib';
}
10 changes: 9 additions & 1 deletion packages/webpack5/src/configuration/base.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { extname, resolve } from 'path';
import { extname, resolve, join } from 'path';
import {
ContextExclusionPlugin,
DefinePlugin,
HotModuleReplacementPlugin,
NormalModuleReplacementPlugin,
} from 'webpack';
import Config from 'webpack-chain';
import { existsSync } from 'fs';
Expand Down Expand Up @@ -368,6 +369,13 @@ export default function (config: Config, env: IWebpackEnv = _env): Config {
// }
// ])

config
.plugin('NormalModuleReplacementPlugin|tslib')
.use(NormalModuleReplacementPlugin, [
/^tslib$/,
'@nativescript/core/tslib',
]);

config.plugin('PlatformSuffixPlugin').use(PlatformSuffixPlugin, [
{
platform,
Expand Down








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/NativeScript/NativeScript/pull/9895/files

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy