Skip to content
Snippets Groups Projects
Verified Commit a6ce396f authored by Kasper Seweryn's avatar Kasper Seweryn :pancakes:
Browse files

Fix django-channels import

`django-channels` module has only dist files which are built with
parcel. This leads to `assignment to undeclared variable parcelRequire`
error.

A simple workaround is to add `var parcelRequire;` to the beginning of
the module.
parent 80ed06db
No related branches found
No related tags found
No related merge requests found
...@@ -3,11 +3,21 @@ ...@@ -3,11 +3,21 @@
import { defineConfig } from 'vite' import { defineConfig } from 'vite'
import { createVuePlugin as vue } from "vite-plugin-vue2"; import { createVuePlugin as vue } from "vite-plugin-vue2";
const path = require("path"); import path from 'path'
// https://vitejs.dev/config/ // https://vitejs.dev/config/
export default defineConfig({ export default defineConfig({
plugins: [vue()], plugins: [
vue(),
{
name: 'fix-django-channels',
transform (src, id) {
if (id.includes('django-channels')) {
return `var parcelRequire;${src}`
}
}
}
],
resolve: { resolve: {
alias: { alias: {
"@": path.resolve(__dirname, "./src"), "@": path.resolve(__dirname, "./src"),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment