Skip to content

Commit aaae0d4

Browse files
rigor789NathanWalker
authored andcommitted
feat: basic webpack-chain setup
1 parent 96da507 commit aaae0d4

File tree

5 files changed

+54
-4
lines changed

5 files changed

+54
-4
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`vue configuration works 1`] = `
4+
Object {
5+
"entry": Object {
6+
"bundle.js": Array [
7+
"bundle.js",
8+
],
9+
},
10+
"module": Object {
11+
"rules": Array [
12+
Object {
13+
"test": /\\\\\\.vue\\$/,
14+
"use": Array [
15+
Object {
16+
"loader": "vue-loader",
17+
"options": Object {
18+
"compiler": "nativescript-vue-template-compiler",
19+
},
20+
},
21+
],
22+
},
23+
],
24+
},
25+
}
26+
`;
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { vueConfig } from '@nativescript/webpack';
2+
3+
describe('vue configuration', () => {
4+
it('works', () => {
5+
expect(vueConfig('')).toMatchSnapshot();
6+
});
7+
});

packages/webpack5/src/configuration/base.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,9 @@ import { Configuration } from 'webpack';
22

33
// todo: add base configuration that's shared across all flavors
44
export default function (env): Configuration {
5-
return {};
5+
return {
6+
entry: {
7+
'bundle.js': 'bundle.js',
8+
},
9+
};
610
}
Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,23 @@
11
import base from './base';
2-
import Config from 'webpack-chain';
2+
import { default as Config } from 'webpack-chain';
33

44
// todo: add base configuration for vue
55
export default function (env) {
66
const config = new Config().merge(base(env));
77

8+
config.module
9+
.rule('vue')
10+
.test(/\.vue$/)
11+
.use('vue-loader')
12+
.loader('vue-loader')
13+
.tap((options) => {
14+
return {
15+
...options,
16+
compiler: 'nativescript-vue-template-compiler',
17+
};
18+
})
19+
.end();
20+
821
// todo: we may want to use webpack-chain internally
922
// to avoid "trying to read property x of undefined" type of issues
1023
/*
@@ -14,5 +27,5 @@ export default function (env) {
1427
});
1528
*/
1629

17-
return {};
30+
return config.toConfig();
1831
}

packages/webpack5/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"src"
2020
]
2121
},
22-
"allowSyntheticDefaultImports": true
22+
"esModuleInterop": true
2323
},
2424
"exclude": [
2525
"node_modules"

0 commit comments

Comments
 (0)