Answer the question
In order to leave comments, you need to log in
How to set up vue in django?
Trying to set up vue in django. I went through everything that is possible, but I did not find a normal full-fledged guide. I'm trying to run
package.json bit by bit
{
"name": "vuewebpack",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "webpack main.js build.js"
},
"author": "yaroslav baev",
"license": "ISC",
"devDependencies": {
"babel": "^6.23.0",
"babel-core": "^6.24.1",
"babel-loader": "^6.4.1",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-preset-es2015": "^6.24.1",
"css-loader": "^0.28.0",
"vue": "^2.2.6",
"vue-html-loader": "^1.2.4",
"vue-loader": "^11.3.4",
"vue-template-compiler": "^2.2.6",
"webpack": "^2.4.1",
"webpack-bundle-tracker": "^0.2.0"
}
}
// var Vue = require('vue')
// var hello = require('vue!../components/hello.vue')
import Vue from 'vue'
import hello from './components/hello.vue'
Vue.config.devtools = false;
Vue.config.delimiters = [''];
new Vue({
el: 'body',
components: {
hello: { hello }
}
});
var path = require('path');
var webpack = require('webpack');
module.exports={
entry:'./main.js',
output:{
path:__dirname,
filename:'build.js'
},
module:{
loaders:[
{test:/.vue$/, loader:'vue-loader'},
{test:/\.js$/, loader:'babel-loader', exclude:/node_modules/}
]
}};
<template>
<h1></h1>
</template>
<script>
module.exports = {
data: function () {
return {
greeting: 'Привет Webpack'
}
}
}
</script>
{% load staticfiles %}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Главная страница</title>
<script src="{% static 'build.js' %}"></script>
</head>
<body>
<hello></hello>
</body>
</html>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question