Minimal webpack workflow created

master
androiddrew 7 years ago
parent 55ce460261
commit c6aa313839

@ -0,0 +1,15 @@
# Vuejs and webpack
## Installation
`npm install`
## Build
To bundle your js code simply use the below command
`npm start`
Alternatively you could return
`node_modules/.bin/webpack --config webpack.config.js`

1
dist/.gitignore vendored

@ -0,0 +1 @@
bundle.js

@ -13,7 +13,6 @@
<div id="app" v-cloak> <div id="app" v-cloak>
{{message}} {{message}}
</div> </div>
<script type="text/javascript" src="node_modules/vue/dist/vue.min.js"></script> <script type="text/javascript" src="dist/bundle.js"></script>
<script type="text/javascript" src="app.js"></script>
</body> </body>
</html> </html>

@ -4,11 +4,16 @@
"description": "Example project using webpack with vuejs", "description": "Example project using webpack with vuejs",
"main": "app.js", "main": "app.js",
"scripts": { "scripts": {
"test": "echo \"Error: no test specified\" && exit 1" "start": "node_modules/.bin/webpack --config webpack.config.js"
}, },
"author": "drew@androiddrew.com", "author": "drew@androiddrew.com",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"vue": "^2.5.13" "vue": "^2.5.13"
},
"devDependencies": {
"babel-core": "^6.26.0",
"babel-loader": "^7.1.2",
"webpack": "^3.10.0"
} }
} }

@ -1,5 +1,5 @@
// app.js // app.js
// import Vue from './node_modules/vue/dist/vue.esm.browser.js' import Vue from '../node_modules/vue/dist/vue.esm.browser.js'
const app = new Vue({ const app = new Vue({
el: '#app', el: '#app',

@ -1,18 +1,18 @@
module.exports = { module.exports = {
// Entry file // Entry file
entry: './app.js', entry: './src/app.js',
output: { output: {
//output bundle //output bundle
filename: 'bundle.js' filename: './dist/bundle.js'
}, },
modules: { module: {
rules: [ rules: [
{ {
// For .js files // For .js files
test: /\.js$/, test: /\.js$/,
use: { use: {
// Use the babel loader // Use the babel loader
loader: 'bable-loader' loader: 'babel-loader'
} }
} }
] ]

Loading…
Cancel
Save