Skip to content

Commit 11a567e

Browse files
committed
test: vue demo N 8
1 parent a822d89 commit 11a567e

File tree

3 files changed

+38
-434
lines changed

3 files changed

+38
-434
lines changed

demo-vue/app.webpack.config.js

Lines changed: 21 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ module.exports = (env, params = {}) => {
4444
const platform = env && ((env.android && 'android') || (env.ios && 'ios'));
4545
const tsconfig = 'tsconfig.json';
4646
const projectRoot = params.projectRoot || __dirname;
47-
const dist = resolve(projectRoot, nsWebpack.getAppPath(platform, projectRoot));
4847
const appResourcesFullPath = resolve(projectRoot, appResourcesPath);
4948

5049
if (!!development) {
@@ -141,12 +140,10 @@ module.exports = (env, params = {}) => {
141140
// }, {});
142141
const scssPrepend = `$mdi-fontFamily: ${platform === 'android' ? 'materialdesignicons-webfont' : 'Material Design Icons'};`;
143142

144-
const css2jsonLoaderRuleIndex = config.module.rules.findIndex(r => r.use && r.use.loader === 'css-loader');
145-
const scssLoaderRuleIndex = config.module.rules.findIndex(r => Array.isArray(r.use) && r.use.indexOf('sass-loader') !== -1);
146-
config.module.rules.splice(scssLoaderRuleIndex, 1);
143+
const scssLoaderRuleIndex = config.module.rules.findIndex((r) => r.test && r.test.toString().indexOf('scss') !== -1);
147144
config.module.rules.splice(
148-
css2jsonLoaderRuleIndex,
149-
0,
145+
scssLoaderRuleIndex,
146+
1,
150147
{
151148
test: /\.scss$/,
152149
exclude: /\.module\.scss$/,
@@ -178,29 +175,6 @@ module.exports = (env, params = {}) => {
178175
]
179176
}
180177
);
181-
const indexOfTsLoaderRule = config.module.rules.findIndex(r => r.loader === 'ts-loader');
182-
config.module.rules[indexOfTsLoaderRule].options.transpileOnly = true;
183-
// config.module.rules[indexOfTsLoaderRule].use.options.getCustomTransformers = (program) => ({
184-
// before: [nativeClassTransformer],
185-
// });
186-
// const mjsRule = {
187-
// test: /\.m?js$/,
188-
// use: {
189-
// loader: 'babel-loader',
190-
// options: {
191-
// presets: [
192-
// [
193-
// '@babel/preset-env',
194-
// {
195-
// useBuiltIns: 'entry',
196-
// exclude: ['@babel/plugin-transform-regenerator'],
197-
// modules:'commonjs',
198-
// },
199-
// ],
200-
// ],
201-
// },
202-
// },
203-
// };
204178

205179
config.module.rules.push({
206180
// rules to replace mdi icons and not use nativescript-font-icon
@@ -224,38 +198,29 @@ module.exports = (env, params = {}) => {
224198
});
225199

226200
// // we remove default rules
227-
config.plugins = config.plugins.filter(p => ['CopyWebpackPlugin'].indexOf(p.constructor.name) === -1);
201+
config.plugins = config.plugins.filter((p) => ['CopyPlugin'].indexOf(p.constructor.name) === -1);
228202
// we add our rules
229-
config.plugins.unshift(
230-
new CopyWebpackPlugin([
231-
{ from: 'fonts/!(ios|android)/**/*', to: 'fonts', flatten: true, noErrorOnMissing: true },
232-
{ from: 'fonts/*', to: 'fonts', flatten: true, noErrorOnMissing: true },
233-
{ from: `fonts/${platform}/**/*`, to: 'fonts', flatten: true, noErrorOnMissing: true },
234-
{
235-
from: '**/*.+(jpg|png)',
236-
globOptions: {
237-
ignore: [`${relative(appPath, appResourcesFullPath)}/**`]
238-
},
239-
noErrorOnMissing: true
240-
},
241-
{ from: 'assets/**/*', noErrorOnMissing: true },
242-
{
243-
from: '../node_modules/@mdi/font/fonts/materialdesignicons-webfont.ttf',
244-
to: 'fonts',
245-
noErrorOnMissing: true
246-
}
247-
])
248-
);
203+
const globOptions = { dot: false, ignore: [`**/${relative(appPath, appResourcesFullPath)}/**`] };
204+
const context = nsWebpack.Utils.platform.getEntryDirPath();
205+
const copyPatterns = [
206+
{ context, from: 'fonts/!(ios|android)/**/*', to: 'fonts/[name][ext]', noErrorOnMissing: true, globOptions },
207+
{ context, from: 'fonts/*', to: 'fonts/[name][ext]', noErrorOnMissing: true, globOptions },
208+
{ context, from: `fonts/${platform}/**/*`, to: 'fonts/[name][ext]', noErrorOnMissing: true, globOptions },
209+
{ context, from: '**/*.jpg', noErrorOnMissing: true, globOptions },
210+
{ context, from: '**/*.png', noErrorOnMissing: true, globOptions },
211+
{ context, from: 'assets/**/*', noErrorOnMissing: true, globOptions },
212+
{
213+
from: 'node_modules/@mdi/font/fonts/materialdesignicons-webfont.ttf',
214+
to: 'fonts',
215+
globOptions
216+
}
217+
];
218+
config.plugins.unshift(new CopyWebpackPlugin({ patterns: copyPatterns }));
249219

250220
if (!!production) {
251221
config.plugins.push(
252222
new ForkTsCheckerWebpackPlugin({
253-
tsconfig: resolve(tsconfig),
254-
async: false,
255-
useTypescriptIncrementalApi: true,
256-
checkSyntacticErrors: true,
257-
memoryLimit: 4096,
258-
workers: 1
223+
tsconfig: resolve(tsconfig)
259224
})
260225
);
261226
}

demo-vue/package.json

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
"description": "NativeScript Material Design Demo for Vue",
33
"license": "SEE LICENSE IN LICENSE.md",
44
"readme": "README.md",
5-
"repository": "http://www.github.com/NativeScript/nativescript-ui-sidedrawer.git",
5+
"main": "app/main",
66
"dependencies": {
77
"@mdi/font": "4.9.95",
8-
"@nativescript/core": "8.0.0-alpha.8",
8+
"@nativescript/core": "8.0.0",
99
"@nativescript-community/text": "1.4.9",
1010
"@nativescript-community/ui-material-activityindicator": "file:../packages/activityindicator",
1111
"@nativescript-community/ui-material-bottom-navigation": "file:../packages/bottom-navigation",
@@ -26,17 +26,17 @@
2626
"@nativescript-community/ui-material-textview": "file:../packages/textview",
2727
"@nativescript/iqkeyboardmanager": "^2.0.0",
2828
"@nativescript/theme": "3.0.1",
29-
"nativescript-vue": "~2.8.4",
30-
"nativescript-vue-template-compiler": "~2.8.4"
29+
"nativescript-vue": "~2.9.0",
30+
"nativescript-vue-template-compiler": "~2.9.0"
3131
},
3232
"devDependencies": {
33-
"@babel/core": "^7.13.10",
34-
"@nativescript/android": "7.0.1",
35-
"@nativescript/types": "7.3.0",
36-
"@nativescript/webpack": "4.1.0",
33+
"@babel/core": "^7.13.14",
34+
"@nativescript/android": "8.0.0",
35+
"@nativescript/types": "8.0.0",
36+
"@nativescript/webpack": "5.0.0-beta.3",
3737
"babel-loader": "^8.2.2",
38-
"nativescript-vue-template-compiler": "~2.8.4",
39-
"sass-loader": "^10.0.2",
38+
"nativescript-vue-template-compiler": "~2.9.0",
39+
"sass-loader": "^11.0.1",
4040
"scss-symbols-parser": "^2.0.1",
4141
"string-replace-loader": "^3.0.1",
4242
"tns-ios":"6.5.4",
@@ -45,8 +45,8 @@
4545
"vue-i18n": "^8.24.1",
4646
"vue-loader": "^15.9.6",
4747
"vue-property-decorator": "^8.5.1",
48-
"webpack": "^4.46.0",
49-
"webpack-cli": "^3.3.12"
48+
"webpack": "^5.30.0",
49+
"webpack-cli": "^4.6.0"
5050
},
5151
"scripts": {
5252
"tslint": "npm i && tslint --config '../tslint.json' 'app/**/*.ts' --exclude '**/node_modules/**'"

0 commit comments

Comments
 (0)