feat(webpack): using new nativescript.config (#8796)

This commit is contained in:
Nathan Walker
2020-08-27 19:43:42 -07:00
committed by GitHub
parent fa9f0957b8
commit 33a703e129
6 changed files with 14 additions and 2 deletions

View File

@ -88,7 +88,15 @@ const getIndentationCharacter = (jsonContent) => {
const getProjectDir = hook.findProjectDir;
const getPackageJsonPath = projectDir => resolve(projectDir, "package.json");
const getPackageJsonPath = projectDir => {
const packagePath = resolve(projectDir, "package.json");
if (fs.existsSync(packagePath)) {
return packagePath;
} else {
return getPackageJsonPath(resolve(projectDir, '..'));
}
}
const getNsConfigPath = projectDir => resolve(projectDir, "nsconfig.json");
const isAndroid = platform => /android/i.test(platform);

View File

@ -1,6 +1,6 @@
{
"name": "@nativescript/webpack",
"version": "2.1.3",
"version": "3.0.0-rc.0",
"main": "index",
"description": "Webpack plugin for NativeScript",
"homepage": "https://nativescript.org",

View File

@ -214,6 +214,7 @@ module.exports = env => {
'node_modules'
],
alias: {
'~/package.json': resolve(projectRoot, 'package.json'),
'~': appFullPath,
"tns-core-modules": "@nativescript/core",
"nativescript-angular": "@nativescript/angular"

View File

@ -67,6 +67,7 @@ module.exports = env => {
const hasRootLevelScopedModules = nsWebpack.hasRootLevelScopedModules({ projectDir: projectRoot });
let coreModulesPackageName = "tns-core-modules";
const alias = env.alias || {};
alias['~/package.json'] = resolve(projectRoot, 'package.json');
alias['~'] = appFullPath;
if (hasRootLevelScopedModules) {

View File

@ -70,6 +70,7 @@ module.exports = env => {
const hasRootLevelScopedModules = nsWebpack.hasRootLevelScopedModules({ projectDir: projectRoot });
let coreModulesPackageName = "tns-core-modules";
const alias = env.alias || {};
alias['~/package.json'] = resolve(projectRoot, 'package.json');
alias['~'] = appFullPath;
if (hasRootLevelScopedModules) {

View File

@ -68,6 +68,7 @@ module.exports = env => {
const hasRootLevelScopedModules = nsWebpack.hasRootLevelScopedModules({ projectDir: projectRoot });
let coreModulesPackageName = "tns-core-modules";
const alias = env.alias || {};
alias['~/package.json'] = resolve(projectRoot, 'package.json');
alias['~'] = appFullPath;
alias['@'] = appFullPath;
alias['vue'] = 'nativescript-vue';