Skip to content

Commit 8a92b25

Browse files
committed
NS8 potentially maybe supposedly working? :/
1 parent 5b04c4c commit 8a92b25

File tree

4 files changed

+19164
-3892
lines changed

4 files changed

+19164
-3892
lines changed

generator/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ module.exports = async (api, options, rootOptions) => {
7878
'clean:ios': 'rimraf platforms/ios'
7979
},
8080
dependencies: {
81-
'nativescript-vue': '^2.5.0-alpha.3',
81+
'nativescript-vue': '^2.9.0',
8282
'tns-core-modules': '^6.3.2'
8383
},
8484
devDependencies: {

index.js

Lines changed: 49 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ const TerserPlugin = require('terser-webpack-plugin');
1212
const VueLoaderPlugin = require('vue-loader/lib/plugin');
1313
const NsVueTemplateCompiler = require('nativescript-vue-template-compiler');
1414

15-
const nsWebpack = require('nativescript-dev-webpack');
16-
const nativescriptTarget = require('nativescript-dev-webpack/nativescript-target');
15+
const nsWebpack = require('@nativescript/webpack');
16+
const nativescriptTarget = require('@nativescript/webpack/nativescript-target');
1717
const { NativeScriptWorkerPlugin } = require('nativescript-worker-loader/NativeScriptWorkerPlugin');
1818

1919
const hashSalt = Date.now().toString();
@@ -151,7 +151,6 @@ module.exports = (api, projectOptions) => {
151151

152152
// setup output directory depending on if we're building for web or native
153153
projectOptions.outputDir = join(projectRoot, appMode === 'web' ? 'dist' : nsWebpack.getAppPath(platform, projectRoot));
154-
155154
return appMode === 'web' ? webConfig(api, projectOptions, env, projectRoot) : nativeConfig(api, projectOptions, env, projectRoot, platform);
156155
};
157156

@@ -165,14 +164,14 @@ const nativeConfig = (api, projectOptions, env, projectRoot, platform) => {
165164
const isNativeOnly = !fs.pathExistsSync(resolve(projectRoot, 'src'));
166165
const tsconfigFileName = 'tsconfig.json';
167166

168-
const appComponents = ['tns-core-modules/ui/frame', 'tns-core-modules/ui/frame/activity'];
167+
const appComponents = ['@nativescript/core/ui/frame', '@nativescript/core/ui/frame/activity'];
169168

170169
const platforms = ['ios', 'android'];
171170

172171
// Default destination inside platforms/<platform>/...
173172
const dist = projectOptions.outputDir;
174173
const appResourcesPlatformDir = platform === 'android' ? 'Android' : 'iOS';
175-
174+
console.log("ENV :>>", env)
176175
const {
177176
// The 'appPath' and 'appResourcesPath' values are fetched from
178177
// the nsconfig.json configuration file
@@ -208,12 +207,12 @@ const nativeConfig = (api, projectOptions, env, projectRoot, platform) => {
208207
const entryModule = nsWebpack.getEntryModule(appFullPath, platform);
209208
const entryPath = `.${sep}${entryModule}`;
210209
const entries = { bundle: entryPath };
211-
const areCoreModulesExternal = Array.isArray(env.externals) && env.externals.some((e) => e.indexOf('tns-core-modules') > -1);
210+
const areCoreModulesExternal = Array.isArray(env.externals) && env.externals.some((e) => e.indexOf('@nativescript/core') > -1);
212211
// // if (platform === 'ios' ) {
213212
// // entries['tns_modules/tns-core-modules/inspector_modules'] = 'inspector_modules.js';
214213
// // }
215214
if (platform === 'ios' && !areCoreModulesExternal) {
216-
entries['tns_modules/tns-core-modules/inspector_modules'] = 'inspector_modules';
215+
entries['tns_modules/@nativescript/core/inspector_modules'] = 'inspector_modules';
217216
}
218217

219218
console.log(`Bundling application for entryPath ${entryPath}...`);
@@ -290,9 +289,9 @@ const nativeConfig = (api, projectOptions, env, projectRoot, platform) => {
290289
config.resolve.modules.delete(resolve(projectRoot, 'node_modules'));
291290

292291
config.resolve.modules // Resolve {N} system modules from tns-core-modules
293-
.add(resolve(projectRoot, 'node_modules/tns-core-modules'))
292+
.add(resolve(projectRoot, 'node_modules/@nativescript/core'))
294293
.add(resolve(projectRoot, 'node_modules'))
295-
.add('node_modules/tns-core-modules')
294+
.add('node_modules/@nativescript/core')
296295
.add('node_modules')
297296
.end()
298297
.alias.delete('vue$')
@@ -368,8 +367,8 @@ const nativeConfig = (api, projectOptions, env, projectRoot, platform) => {
368367
.rule('native-loaders')
369368
// .test(new RegExp(entryPath)) --> OLD ENTRY - TO BE REMOVED
370369
.test(new RegExp(nsWebpack.getEntryPathRegExp(appFullPath, entryPath + '.(js|ts)')))
371-
.use('nativescript-dev-webpack/bundle-config-loader')
372-
.loader('nativescript-dev-webpack/bundle-config-loader')
370+
.use('@nativescript/webpack/bundle-config-loader')
371+
.loader('@nativescript/webpack/bundle-config-loader')
373372
.options({
374373
registerPages: true, // applicable only for non-angular apps
375374
loadCss: !snapshot, // load the application css if in debug mode
@@ -383,12 +382,12 @@ const nativeConfig = (api, projectOptions, env, projectRoot, platform) => {
383382
config.when(platform === 'android', (config) => {
384383
config.module
385384
.rule('native-loaders')
386-
.use('nativescript-dev-webpack/android-app-components-loader')
387-
.loader('nativescript-dev-webpack/android-app-components-loader')
385+
.use('@nativescript/webpack/helpers/android-app-components-loader')
386+
.loader('@nativescript/webpack/helpers/android-app-components-loader')
388387
.options({
389388
modules: appComponents
390389
})
391-
.before('nativescript-dev-webpack/bundle-config-loader')
390+
.before('@nativescript/webpack/bundle-config-loader')
392391
.end();
393392
});
394393

@@ -527,13 +526,13 @@ const nativeConfig = (api, projectOptions, env, projectRoot, platform) => {
527526
config.module
528527
.rule('css')
529528
.oneOf('normal')
530-
.use('nativescript-dev-webpack/apply-css-loader')
531-
.loader('nativescript-dev-webpack/apply-css-loader')
529+
.use('@nativescript/webpack/helpers/apply-css-loader')
530+
.loader('@nativescript/webpack/helpers/apply-css-loader')
532531
.before('css-loader')
533532
.end()
534-
.use('nativescript-dev-webpack/style-hot-loader')
535-
.loader('nativescript-dev-webpack/style-hot-loader')
536-
.before('nativescript-dev-webpack/apply-css-loader')
533+
.use('@nativescript/webpack/helpers/style-hot-loader')
534+
.loader('@nativescript/webpack/helpers/style-hot-loader')
535+
.before('@nativescript/webpack/helpers/apply-css-loader')
537536
.end()
538537
.use('css-loader')
539538
.loader('css-loader')
@@ -572,13 +571,13 @@ const nativeConfig = (api, projectOptions, env, projectRoot, platform) => {
572571
config.module
573572
.rule('scss')
574573
.oneOf('normal')
575-
.use('nativescript-dev-webpack/apply-css-loader')
576-
.loader('nativescript-dev-webpack/apply-css-loader')
574+
.use('@nativescript/webpack/helpers/apply-css-loader')
575+
.loader('@nativescript/webpack/helpers/apply-css-loader')
577576
.before('css-loader')
578577
.end()
579-
.use('nativescript-dev-webpack/style-hot-loader')
580-
.loader('nativescript-dev-webpack/style-hot-loader')
581-
.before('nativescript-dev-webpack/apply-css-loader')
578+
.use('@nativescript/webpack/helpers/style-hot-loader')
579+
.loader('@nativescript/webpack/helpers/style-hot-loader')
580+
.before('@nativescript/webpack/helpers/apply-css-loader')
582581
.end()
583582
.use('css-loader')
584583
.loader('css-loader')
@@ -609,7 +608,7 @@ const nativeConfig = (api, projectOptions, env, projectRoot, platform) => {
609608
{
610609
// minimize: false,
611610
// url: false,
612-
prependData: '$PLATFORM: ' + platform + ';'
611+
// prependData: '$PLATFORM: ' + platform + ';'
613612
}
614613
)
615614
)
@@ -634,13 +633,13 @@ const nativeConfig = (api, projectOptions, env, projectRoot, platform) => {
634633
config.module
635634
.rule('sass')
636635
.oneOf('normal')
637-
.use('nativescript-dev-webpack/apply-css-loader')
638-
.loader('nativescript-dev-webpack/apply-css-loader')
636+
.use('@nativescript/webpack/helpers/apply-css-loader')
637+
.loader('@nativescript/webpack/helpers/apply-css-loader')
639638
.before('css-loader')
640639
.end()
641-
.use('nativescript-dev-webpack/style-hot-loader')
642-
.loader('nativescript-dev-webpack/style-hot-loader')
643-
.before('nativescript-dev-webpack/apply-css-loader')
640+
.use('@nativescript/webpack/helpers/style-hot-loader')
641+
.loader('@nativescript/webpack/helpers/style-hot-loader')
642+
.before('@nativescript/webpack/helpers/apply-css-loader')
644643
.end()
645644
.use('css-loader')
646645
.loader('css-loader')
@@ -692,13 +691,13 @@ const nativeConfig = (api, projectOptions, env, projectRoot, platform) => {
692691
config.module
693692
.rule('stylus')
694693
.oneOf('normal')
695-
.use('nativescript-dev-webpack/apply-css-loader')
696-
.loader('nativescript-dev-webpack/apply-css-loader')
694+
.use('@nativescript/webpack/helpers/apply-css-loader')
695+
.loader('@nativescript/webpack/helpers/apply-css-loader')
697696
.before('css-loader')
698697
.end()
699-
.use('nativescript-dev-webpack/style-hot-loader')
700-
.loader('nativescript-dev-webpack/style-hot-loader')
701-
.before('nativescript-dev-webpack/apply-css-loader')
698+
.use('@nativescript/webpack/helpers/style-hot-loader')
699+
.loader('@nativescript/webpack/helpers/style-hot-loader')
700+
.before('@nativescript/webpack/helpers/apply-css-loader')
702701
.end()
703702
.use('css-loader')
704703
.loader('css-loader')
@@ -748,13 +747,13 @@ const nativeConfig = (api, projectOptions, env, projectRoot, platform) => {
748747
config.module
749748
.rule('less')
750749
.oneOf('normal')
751-
.use('nativescript-dev-webpack/apply-css-loader')
752-
.loader('nativescript-dev-webpack/apply-css-loader')
750+
.use('@nativescript/webpack/helpers/apply-css-loader')
751+
.loader('@nativescript/webpack/helpers/apply-css-loader')
753752
.before('css-loader')
754753
.end()
755-
.use('nativescript-dev-webpack/style-hot-loader')
756-
.loader('nativescript-dev-webpack/style-hot-loader')
757-
.before('nativescript-dev-webpack/apply-css-loader')
754+
.use('@nativescript/webpack/helpers/style-hot-loader')
755+
.loader('@nativescript/webpack/helpers/style-hot-loader')
756+
.before('@nativescript/webpack/helpers/apply-css-loader')
758757
.end()
759758
.use('css-loader')
760759
.loader('css-loader')
@@ -795,14 +794,14 @@ const nativeConfig = (api, projectOptions, env, projectRoot, platform) => {
795794
// config.module.rules.push(
796795
// {
797796
// test: /-page\.js$/,
798-
// use: "nativescript-dev-webpack/script-hot-loader"
797+
// use: "@nativescript/webpack/helpers/script-hot-loader"
799798
// },
800799
// {
801800
// test: /\.(html|xml)$/,
802-
// use: "nativescript-dev-webpack/markup-hot-loader"
801+
// use: "@nativescript/webpack/helpers/markup-hot-loader"
803802
// },
804803

805-
// { test: /\.(html|xml)$/, use: "nativescript-dev-webpack/xml-namespace-loader" }
804+
// { test: /\.(html|xml)$/, use: "@nativescript/webpack/helpers/xml-namespace-loader" }
806805
// );
807806
// }
808807

@@ -847,7 +846,10 @@ const nativeConfig = (api, projectOptions, env, projectRoot, platform) => {
847846
Object.assign(config.plugin('define').get('args')[0], {
848847
'global.TNS_WEBPACK': 'true',
849848
TNS_ENV: JSON.stringify(mode),
850-
process: 'global.process'
849+
process: 'global.process',
850+
__UI_USE_XML_PARSER__: true,
851+
__UI_USE_EXTERNAL_RENDERER__: false,
852+
__CSS_PARSER__: JSON.stringify('css-tree')
851853
})
852854
])
853855
.end();
@@ -967,7 +969,7 @@ const nativeConfig = (api, projectOptions, env, projectRoot, platform) => {
967969
.end();
968970
}
969971

970-
// the next several items are disabled as they are mirrored from the nativescript-dev-webpack
972+
// the next several items are disabled as they are mirrored from the @nativescript/webpack
971973
// project. Need to figure out how to integrate some of that projects cli ability into this one.
972974
config.when(report, (config) => {
973975
config
@@ -990,13 +992,14 @@ const nativeConfig = (api, projectOptions, env, projectRoot, platform) => {
990992
.use(nsWebpack.NativeScriptSnapshotPlugin, [
991993
{
992994
chunk: 'vendor',
993-
requireModules: ['tns-core-modules/bundle-entry-points'],
995+
requireModules: ['@nativescript/core/bundle-entry-points'],
994996
projectRoot,
995997
webpackConfig: config
996998
}
997999
])
9981000
.end();
9991001
});
1002+
console.log(config)
10001003
});
10011004
};
10021005

0 commit comments

Comments
 (0)