Skip to content

Commit ea7c6b7

Browse files
committed
fix: vue 2 templates
1 parent 946dad7 commit ea7c6b7

File tree

4 files changed

+82
-7
lines changed

4 files changed

+82
-7
lines changed

packages/template-blank-vue-ts/package.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "@nativescript/template-blank-vue-ts",
33
"main": "app/app.ts",
44
"displayName": "Blank Vue Typescript",
5-
"version": "9.0.2",
5+
"version": "9.0.3",
66
"description": "Blank Typescript template for NativeScript apps using Vue.",
77
"author": "NativeScript Team <[email protected]>",
88
"license": "Apache-2.0",
@@ -26,6 +26,7 @@
2626
"types",
2727
".editorconfig",
2828
"tailwind.config.js",
29+
"webpack.config.js",
2930
"tsconfig.json"
3031
],
3132
"keywords": [
@@ -47,11 +48,13 @@
4748
},
4849
"devDependencies": {
4950
"@nativescript/types": "~9.0.0",
50-
"@nativescript/webpack": "5.0.24",
51+
"@nativescript/webpack": "~5.0.31",
5152
"@types/node": "^20.0.0",
5253
"nativescript-vue-template-compiler": "~2.9.3",
5354
"tailwindcss": "~3.4.0",
5455
"typescript": "~5.4.0",
55-
"vue": "~2.6.12"
56+
"vue": "~2.6.12",
57+
"vue-loader": "^15.11.1",
58+
"vue-template-compiler": "^2.7.16"
5659
}
5760
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
const webpack = require("@nativescript/webpack");
2+
const path = require("path");
3+
const VueLoaderPlugin = require("vue-loader/lib/plugin");
4+
5+
module.exports = (env) => {
6+
webpack.init(env);
7+
8+
// Learn how to customize:
9+
// https://docs.nativescript.org/webpack
10+
11+
webpack.chainWebpack((config) => {
12+
// Use vue-loader@15 for Vue 2
13+
config.resolve.alias.set(
14+
"vue-loader",
15+
path.resolve(__dirname, "node_modules/vue-loader")
16+
);
17+
18+
// Remove the default VueLoaderPlugin (v17) and add v15
19+
config.plugins.delete("VueLoaderPlugin");
20+
config.plugin("VueLoaderPlugin").use(VueLoaderPlugin);
21+
22+
// Configure vue-loader for Vue 2
23+
config.module
24+
.rule("vue")
25+
.use("vue-loader")
26+
.loader(require.resolve("vue-loader"))
27+
.tap((options) => ({
28+
...options,
29+
compiler: require("vue-template-compiler"),
30+
}));
31+
});
32+
33+
return webpack.resolveConfig();
34+
};

packages/template-blank-vue/package.json

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "@nativescript/template-blank-vue",
33
"main": "app/app.js",
44
"displayName": "Blank",
5-
"version": "9.0.1",
5+
"version": "9.0.2",
66
"description": "Blank template for NativeScript apps using Vue.",
77
"author": "NativeScript Team <[email protected]>",
88
"license": "Apache-2.0",
@@ -24,7 +24,8 @@
2424
"tools",
2525
"!tools/assets",
2626
".editorconfig",
27-
"jsconfig.json"
27+
"jsconfig.json",
28+
"webpack.config.js"
2829
],
2930
"keywords": [
3031
"nstudio",
@@ -45,7 +46,10 @@
4546
"nativescript-vue": "~2.9.3"
4647
},
4748
"devDependencies": {
48-
"@nativescript/webpack": "5.0.24",
49-
"nativescript-vue-template-compiler": "~2.9.3"
49+
"@nativescript/webpack": "~5.0.31",
50+
"nativescript-vue-template-compiler": "~2.9.3",
51+
"vue": "~2.6.12",
52+
"vue-loader": "^15.11.1",
53+
"vue-template-compiler": "^2.7.16"
5054
}
5155
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
const webpack = require("@nativescript/webpack");
2+
const path = require("path");
3+
const VueLoaderPlugin = require("vue-loader/lib/plugin");
4+
5+
module.exports = (env) => {
6+
webpack.init(env);
7+
8+
// Learn how to customize:
9+
// https://docs.nativescript.org/webpack
10+
11+
webpack.chainWebpack((config) => {
12+
// Use vue-loader@15 for Vue 2
13+
config.resolve.alias.set(
14+
"vue-loader",
15+
path.resolve(__dirname, "node_modules/vue-loader")
16+
);
17+
18+
// Remove the default VueLoaderPlugin (v17) and add v15
19+
config.plugins.delete("VueLoaderPlugin");
20+
config.plugin("VueLoaderPlugin").use(VueLoaderPlugin);
21+
22+
// Configure vue-loader for Vue 2
23+
config.module
24+
.rule("vue")
25+
.use("vue-loader")
26+
.loader(require.resolve("vue-loader"))
27+
.tap((options) => ({
28+
...options,
29+
compiler: require("vue-template-compiler"),
30+
}));
31+
});
32+
33+
return webpack.resolveConfig();
34+
};

0 commit comments

Comments
 (0)