Skip to content

[WIP]add ts support #633

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions template/build/webpack.base.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ function resolve (dir) {

module.exports = {
entry: {
app: './src/main.js'
app: './src/main.ts'
},
output: {
path: config.build.assetsRoot,
Expand All @@ -19,7 +19,7 @@ module.exports = {
: config.dev.assetsPublicPath
},
resolve: {
extensions: ['.js', '.vue', '.json'],
extensions: ['.js', '.vue', '.json', '.ts'],
alias: {
{{#if_eq build "standalone"}}
'vue$': 'vue/dist/vue.esm.js',
Expand All @@ -45,6 +45,14 @@ module.exports = {
loader: 'vue-loader',
options: vueLoaderConfig
},
{
test: /\.ts$/,
loader: 'ts-loader',
include: [resolve('src'), resolve('test')],
options: {
appendTsSuffixTo: [/\.vue$/]
}
},
{
test: /\.js$/,
loader: 'babel-loader',
Expand Down
3 changes: 3 additions & 0 deletions template/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@
"vue-loader": "^11.1.4",
"vue-style-loader": "^2.0.0",
"vue-template-compiler": "^2.2.4",
"vue-class-component": "^5.0.0",
"ts-loader": "^2.0.3",
"typescript": "^2.2.1",
"webpack": "^2.2.1",
"webpack-dev-middleware": "^1.10.0",
"webpack-hot-middleware": "^2.16.1",
Expand Down
2 changes: 1 addition & 1 deletion template/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</div>
</template>

<script>
<script lang="ts">
{{#unless router}}
import Hello from './components/Hello'{{#if_eq lintConfig "airbnb"}};{{/if_eq}}

Expand Down
2 changes: 1 addition & 1 deletion template/src/components/Hello.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
</div>
</template>

<script>
<script lang="ts">
export default {
name: 'hello',
data{{#unless_eq lintConfig "airbnb"}} {{/unless_eq}}() {
Expand Down
File renamed without changes.
File renamed without changes.
14 changes: 14 additions & 0 deletions template/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"compilerOptions": {
"experimentalDecorators": true,
"allowSyntheticDefaultImports": true,
"module": "es2015",
"moduleResolution": "node",
"noImplicitAny": true,
"target": "es5",
"lib": ["dom", "es5", "es2015.promise"]
},
"files": [
"./src/main.ts"
]
}