Comments (7)
The js (render_bundle) needs somehow to come after the vue tag reference in the html file!
This works:
{% load staticfiles %}
{% load render_bundle from webpack_loader %}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Webpack Sample Project</title>
</head>
<body>
<h3>[[ message ]]</h3>
kiekeboe
{% render_bundle 'main' %}
</body>
</html>
from django-webpack-loader.
@musicformellons Could you please share your config of webpack for vuejs?
I am struggling putting together Django and VueJS.
Thank you.
from django-webpack-loader.
I jumped the fence into javascript land... No more Django... Sorry... Good luck.
from django-webpack-loader.
I'm using Vue.js with Django Webpack loader without problems. Here is my index.html template.
{% load render_bundle from webpack_loader %}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>App Title</title>
{% render_bundle 'public' 'css' %}
</head>
<body>
<div id="stx-viewport"></div>
{% render_bundle 'public' 'js'%}
</body>
</html>
from django-webpack-loader.
@rawberg I don't have a problem with template part, these few tags are easy.
I was wondering about webpack config with hot reload, could you please share that? Thanks.
from django-webpack-loader.
I haven't gone through the trouble of setting up hot reload but good old fashioned refresh seems to work pretty well with this setup.
module: {
loaders: [
{
test: /\.vue$/,
loader: 'vue'
},
{
test: /\.js$/,
loader: 'babel',
exclude: /node_modules/
},
{
test: /\.json$/,
loader: 'json',
exclude: /node_modules/
},
{
test: /\.css$/,
loader: ExtractTextPlugin.extract({fallbackLoader: "style-loader", loader: "css-loader"}),
exclude: /node_modules/
},
{
test: /\.less$/,
loader: ExtractTextPlugin.extract({fallbackLoader: "style-loader", loader: "css-loader!less-loader"})
},
// handles all references to these files in JS or CSS, use copy webpack plugin
// for images references in HTML or anywhere else
{
test: /\.(png|jpg|gif|svg|gif)$/,
loader: 'file-loader',
query: {
name: 'img/[name]-[hash].[ext]'
}
},
{
test: /\.(ttf|eot|woff|woff2)$/,
loader: 'file-loader',
query: {
name: 'font/[name]-[hash].[ext]'
}
},
{
test: /\.(txt|ico)$/,
loader: 'static-loader'
}
]
from django-webpack-loader.
@rawberg Thank you. This is very helpful.
from django-webpack-loader.
Related Issues (20)
- Refused to execute script from '..main.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled. HOT 3
- Document better publicPath need for code splitting HOT 1
- get_files interface has changed HOT 1
- KeyError: 'status' when trying to `render_bundle` HOT 2
- Upgrading to Django 4.0 gives me "AttributeError: 'SafeString' object has no attribute 'get_bundle'" HOT 2
- Config.py enhancement please? HOT 4
- Exception in Loader.filter_chunks due to wrong webpack-stats.json data format HOT 5
- Need help with render_bundle after changing directory structure HOT 5
- STATIC_URL = '/static_dev/' is not respected HOT 1
- An proposal for a better `webpack_static` HOT 2
- Generated path in HTML not getting updated HOT 2
- Webpack loader blocks all requests silently if webpack-stats hangs at "compile" HOT 1
- Not loading image processed by webpack correctly HOT 7
- Problem with hot reload example on Node v18 LTS
- should FakeWebpackLoader also mock get_assets? HOT 1
- Support publicPath: "auto" HOT 2
- render _bundle error: TypeError: expected string or bytes-like object HOT 8
- I clone the simple app to my pycharm then install the dependency but get error when startup HOT 1
- `get_chunk_url` always uses `publicPath`, prevents cdn host. HOT 3
- critical css HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from django-webpack-loader.