feat: additional base setup

This commit is contained in:
Igor Randjelovic
2020-11-14 16:16:49 +01:00
committed by Nathan Walker
parent 3f9871dec6
commit 362ff6a46f
6 changed files with 248 additions and 77 deletions

View File

@@ -1,47 +1,136 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`vue configuration works 1`] = `
Object {
"entry": Object {
"": Array [],
},
"module": Object {
"rules": Array [
Object {
"test": /\\\\\\.vue\\$/,
"use": Array [
Object {
"loader": "vue-loader",
"options": Object {
"compiler": "nativescript-vue-template-compiler",
},
},
],
},
Object {
"use": Array [
Object {
"loader": "ts-loader",
"options": Object {
"appendTsSuffixTo": Array [
/\\\\\\.vue\\$/,
],
},
},
],
},
],
},
"plugins": Array [
VueLoaderPlugin {},
],
"resolve": Object {
"alias": Object {
"vue": "nativescript-vue",
exports[`vue configuration [android] works 1`] = `
"{
resolve: {
symlinks: true,
alias: {
'~/package.json': 'package.json',
'~': '<TODO>appFullPath',
'@': '<TODO>appFullPath',
vue: 'nativescript-vue'
},
"extensions": Array [
".vue",
],
extensions: [
'.vue'
]
},
}
module: {
rules: [
/* config.module.rule('vue') */
{
test: /\\\\.vue$/,
use: [
/* config.module.rule('vue').use('vue-loader') */
{
loader: 'vue-loader',
options: {
compiler: 'nativescript-vue-template-compiler'
}
}
]
},
/* config.module.rule('ts') */
{
use: [
/* config.module.rule('ts').use('ts-loader') */
{
loader: 'ts-loader',
options: {
appendTsSuffixTo: [
/\\\\.vue$/
]
}
}
]
}
]
},
plugins: [
/* config.plugin('clean') */
new CleanWebpackPlugin(
{
cleanOnceBeforeBuildPatterns: [
'platforms/android/app/src/main/assets/app/**/*'
],
verbose: true
}
),
/* config.plugin('vue-plugin') */
new VueLoaderPlugin()
],
entry: {
bundle: [
'todo/main'
]
}
}"
`;
exports[`vue configuration [ios] works 1`] = `
"{
resolve: {
symlinks: true,
alias: {
'~/package.json': 'package.json',
'~': '<TODO>appFullPath',
'@': '<TODO>appFullPath',
vue: 'nativescript-vue'
},
extensions: [
'.vue'
]
},
module: {
rules: [
/* config.module.rule('vue') */
{
test: /\\\\.vue$/,
use: [
/* config.module.rule('vue').use('vue-loader') */
{
loader: 'vue-loader',
options: {
compiler: 'nativescript-vue-template-compiler'
}
}
]
},
/* config.module.rule('ts') */
{
use: [
/* config.module.rule('ts').use('ts-loader') */
{
loader: 'ts-loader',
options: {
appendTsSuffixTo: [
/\\\\.vue$/
]
}
}
]
}
]
},
plugins: [
/* config.plugin('clean') */
new CleanWebpackPlugin(
{
cleanOnceBeforeBuildPatterns: [
'platforms/ios/[todo]/app/**/*'
],
verbose: true
}
),
/* config.plugin('vue-plugin') */
new VueLoaderPlugin()
],
entry: {
inspector_modules: [
'tns_modules/@nativescript/core/inspector_modules'
],
bundle: [
'todo/main'
]
}
}"
`;

View File

@@ -1,7 +1,15 @@
import { vueConfig } from '@nativescript/webpack';
import { __vue } from '@nativescript/webpack';
describe('vue configuration', () => {
it('works', () => {
expect(vueConfig('')).toMatchSnapshot();
});
const platforms = ['ios', 'android'];
for (let platform of platforms) {
it(`[${platform}] works`, () => {
expect(
__vue({
[platform]: true,
}).toString()
).toMatchSnapshot();
});
}
});