mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-16 03:31:45 +08:00
feat: basic webpack-chain setup
This commit is contained in:
@ -0,0 +1,26 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`vue configuration works 1`] = `
|
||||
Object {
|
||||
"entry": Object {
|
||||
"bundle.js": Array [
|
||||
"bundle.js",
|
||||
],
|
||||
},
|
||||
"module": Object {
|
||||
"rules": Array [
|
||||
Object {
|
||||
"test": /\\\\\\.vue\\$/,
|
||||
"use": Array [
|
||||
Object {
|
||||
"loader": "vue-loader",
|
||||
"options": Object {
|
||||
"compiler": "nativescript-vue-template-compiler",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
}
|
||||
`;
|
7
packages/webpack5/__tests__/configuration/vue.spec.ts
Normal file
7
packages/webpack5/__tests__/configuration/vue.spec.ts
Normal file
@ -0,0 +1,7 @@
|
||||
import { vueConfig } from '@nativescript/webpack';
|
||||
|
||||
describe('vue configuration', () => {
|
||||
it('works', () => {
|
||||
expect(vueConfig('')).toMatchSnapshot();
|
||||
});
|
||||
});
|
@ -2,5 +2,9 @@ import { Configuration } from 'webpack';
|
||||
|
||||
// todo: add base configuration that's shared across all flavors
|
||||
export default function (env): Configuration {
|
||||
return {};
|
||||
return {
|
||||
entry: {
|
||||
'bundle.js': 'bundle.js',
|
||||
},
|
||||
};
|
||||
}
|
||||
|
@ -1,10 +1,23 @@
|
||||
import base from './base';
|
||||
import Config from 'webpack-chain';
|
||||
import { default as Config } from 'webpack-chain';
|
||||
|
||||
// todo: add base configuration for vue
|
||||
export default function (env) {
|
||||
const config = new Config().merge(base(env));
|
||||
|
||||
config.module
|
||||
.rule('vue')
|
||||
.test(/\.vue$/)
|
||||
.use('vue-loader')
|
||||
.loader('vue-loader')
|
||||
.tap((options) => {
|
||||
return {
|
||||
...options,
|
||||
compiler: 'nativescript-vue-template-compiler',
|
||||
};
|
||||
})
|
||||
.end();
|
||||
|
||||
// todo: we may want to use webpack-chain internally
|
||||
// to avoid "trying to read property x of undefined" type of issues
|
||||
/*
|
||||
@ -14,5 +27,5 @@ export default function (env) {
|
||||
});
|
||||
*/
|
||||
|
||||
return {};
|
||||
return config.toConfig();
|
||||
}
|
||||
|
@ -19,7 +19,7 @@
|
||||
"src"
|
||||
]
|
||||
},
|
||||
"allowSyntheticDefaultImports": true
|
||||
"esModuleInterop": true
|
||||
},
|
||||
"exclude": [
|
||||
"node_modules"
|
||||
|
Reference in New Issue
Block a user