Last active
February 15, 2022 21:43
-
-
Save vfeskov/8d8938ab7a2cfd0a6a532ef51c211746 to your computer and use it in GitHub Desktop.
Minimal Vue + Webpack project
This file contains hidden or 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
<!doctype html> | |
<html> | |
<body> | |
<a id="link" v-on:click="clickEvent" href="#">A</a> | |
<script src="bundle.js"/> | |
</body> | |
</html> |
This file contains hidden or 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/dist/vue.esm' | |
new Vue({ | |
el: '#link', | |
methods: { | |
clickEvent: function(e) { | |
e.preventDefault() | |
console.log("Vue is working"); | |
} | |
} | |
}) |
This file contains hidden or 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
// first run | |
// npm install [email protected] @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