Last active
October 10, 2018 07:36
-
-
Save kenichi-odo/44ccc3ada8a4a7f1868c284d6096e3ed to your computer and use it in GitHub Desktop.
Visualforce上で動くTypeScript + Vue.jsをVisual Studio Codeで開発する ref: https://qiita.com/kenichi_odo/items/8fc18e6020a2e35318ea
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<div> | |
{{text}} | |
<child-component> | |
</child-component> | |
</div> | |
</template> | |
<script> | |
import ChildComponent from './child-component.vue' | |
export default { | |
data() { | |
return { text: 'foobar' } | |
}, | |
components: { | |
'child-component': ChildComponent | |
} | |
} | |
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<input type="button" | |
:value="button_name" | |
@click="showAlert" /> | |
</template> | |
<script> | |
export default { | |
data() { | |
return { button_name: 'foo' } | |
}, | |
methods: { | |
showAlert(): void { | |
alert('bar') | |
} | |
} | |
} | |
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
brew cask update | |
brew cask install visual-studio-code |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Vue from 'vue' | |
import App from './app.vue' | |
new Vue({ | |
el: '#app', | |
render: _ => _(App) | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"devDependencies": { | |
"typescript": "^2.2.2", | |
"vue": "^2.2.6", | |
"vue-loader": "^11.3.4", | |
"vue-template-compiler": "^2.2.6", | |
"vue-ts-loader": "0.0.3", | |
"vue-typescript-import-dts": "^3.0.1", | |
"webpack": "^2.3.3", | |
"webpack-sfdc-deploy-plugin": "^1.1.9" | |
}, | |
"scripts": { | |
"build-VueTest": "webpack --env.resource_name=VueTest", | |
"watch-VueTest": "webpack -w --env.resource_name=VueTest" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = { | |
username: 'user@test.com', | |
password: 'password', | |
token: '' | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
{ | |
"compilerOptions": { | |
"module": "es2015", | |
"moduleResolution": "node", | |
"types": [ | |
"vue-typescript-import-dts" | |
], | |
"allowSyntheticDefaultImports": true | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<apex:page | |
sidebar="false" | |
showHeader="false" | |
standardStylesheets="false" | |
applyBodyTag="false" | |
applyHtmlTag="false" | |
docType="html-5.0"> | |
<html> | |
<head> | |
<meta charset="UTF-8" /> | |
</head> | |
<body style="margin: 0;"> | |
<div id="app"></div> | |
<script src="{!URLFOR($Resource.VueTest, 'bundle.js')}"></script> | |
</body> | |
</html> | |
</apex:page> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Webpack = require('webpack') | |
var SfdcDeployPlugin = require('webpack-sfdc-deploy-plugin') | |
module.exports = function (env_) { | |
return { | |
entry: './src/' + env_.resource_name + '/index.ts', | |
output: { | |
filename: './build/' + env_.resource_name + '/bundle.js' | |
}, | |
devtool: 'source-map', | |
module: { | |
loaders: [ | |
{ test: /\.ts$/, loader: 'vue-ts-loader' }, | |
{ test: /\.vue$/, loader: 'vue-loader' } | |
] | |
}, | |
resolve: { alias: { vue: 'vue/dist/vue.js' } }, | |
plugins: [ | |
new Webpack.LoaderOptionsPlugin({ | |
options: { | |
resolve: { extensions: ['.ts', '.vue'] }, | |
vue: { | |
loaders: { js: 'vue-ts-loader' } | |
} | |
} | |
}), | |
new SfdcDeployPlugin({ | |
credentialsPath: __dirname + '/sfdc-org-config.js', | |
filesFolderPath: './build/' + env_.resource_name, | |
staticResourceName: env_.resource_name | |
}) | |
] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment