Skip to content

Instantly share code, notes, and snippets.

@vfeskov
Last active February 15, 2022 21:43
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vfeskov/8d8938ab7a2cfd0a6a532ef51c211746 to your computer and use it in GitHub Desktop.
Save vfeskov/8d8938ab7a2cfd0a6a532ef51c211746 to your computer and use it in GitHub Desktop.
Minimal Vue + Webpack project
<!doctype html>
<html>
<body>
<a id="link" v-on:click="clickEvent" href="#">A</a>
<script src="bundle.js"/>
</body>
</html>
import Vue from 'vue/dist/vue.esm'
new Vue({
el: '#link',
methods: {
clickEvent: function(e) {
e.preventDefault()
console.log("Vue is working");
}
}
})
// first run
// npm install babel-loader@8.0.0-beta.0 @babel/core @babel/preset-env webpack --save
const config = {
entry: './index',
context: __dirname,
output: {
filename: 'bundle.js'
},
module: {
loaders: [
{
test: /\.js$/,
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env']
}
}
]
},
resolve: {
extensions: ['.js']
}
}
module.exports = config
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment