Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Harkirat Saluja
    @jinxac
    hi @owais
    i just raised an issue regarding react router on the github project.. can you please help me on this?
    Konstantinos Stratis
    @kstratis
    hello @owais !
    is the room still active?
    Owais Lone
    @owais
    Not really active but I do get notifications and I try to reply when I see one.
    Konstantinos Stratis
    @kstratis
    Good to know! Thanks!
    David Feinberg
    @rawberg
    clarification question: in regular mode without hot reloading. are the files supposed to be served from the bundles directory (./assets/bundles) or from the static files directory after they've been copied by django's collectstatic files process?
    David Feinberg
    @rawberg
    got it working. my problem was I had publicPath set in the output section of my webpack config and that was messing up the output of webpack-stats.json
    Abhinav Nair
    @abhinavnair
    Hi, Can someone please help me with this doubt. Isn't the static files (for production at least) supposed to be read from the assets directory? If yes, then currently webpack-loader reads from the static dir instead of the assets dir. How can I set it to read from the assets folder?
    liondancer
    @liondancer
    hello
    I’m a bit confused as how to handle loading images with webpack and django...
    konoufo
    @konoufo
    @liondancer Images are static files, so if you serve static files (thru django, or anything else really) at some url you can reference this url (ex: http://mywebsite.com/static/image.png) wherever you need it. There is hardly anything related to webpack-loader in that respect.
    liondancer
    @liondancer
    @konoufo i got it working
    thanks!
    konoufo
    @konoufo
    @liondancer Cool !
    Filip Figiel
    @megapctr
    is it possible to surpass WebpackErrors?
    I'm using HMR and when I have an error, the WebpackError is shown and fixing the error doesn't reload the page
    which kind of defeats the purpose of HMR
    Owais Lone
    @owais
    No, it's not possible currently. Implementing something like this will very quite complex but feel free to send a proposal my way
    @abhinavnair Configure your webpack build to output the builds anywhere you want including your assets directory. They'll be read from whereever webpack outputs them
    Filip Figiel
    @megapctr
    thanks for reply @owais, I managed to solve my problem by changing STATIC_URL to point to WDS, I don't even need the django loader anymore :)
    konoufo
    @konoufo
    @megapctr except you probably don't want to use the WDS in production.
    Filip Figiel
    @megapctr
    Of course, I'd use a different static root in prod
    *static url
    liondancer
    @liondancer
    Now that Im using webpack and react as my frontend and django as my backend. I am having a hard time dealing with CSRF in forms. Before I dabbled with django templates and it was pretty easy to get CSRF setup but I am pretty lost on how to do this now
    konoufo
    @konoufo

    @liondancer , you've got several ways but this is how i'd do it. You just have to add an extra header to the request when submitting a form. I use superagent to post forms, so it would go like this:

    // 'cookie' is a tiny JS library used to easily interact with cookies 
    request
        .set('X-CSRFToken',  cookie.get('csrftoken')), 
        .send(formdata)
        .end(function(err, res){/*do this after request*/})

    Note that you should ensure that csrf cookies are used in your django view .

    Eitan R
    @erosenberg
    I guess this applies here too, @owais - but I'm trying to render_bundle 'main' 'css' and it's not finding it... any ideas?
    Owais Lone
    @owais
    Could you please share you webpack config, django settings, webpack build output. template code and contents of rendered HTML page?
    Eitan R
    @erosenberg
    @owais - yeah, I responded in the other room (webpack-bundle-tracker)... should I post it here instead?
    Owais Lone
    @owais
    No, let's discuss in a single place. The issue seems to be more relevant to bundle tracker anyway
    EmilLuta
    @EmilLuta

    Hello! I just wanted to introduce assets through the main pipeline, but I ran into issues trying to run tests and all that. Let me know when you have a minute so we can discuss about that. Thank you very much!

    P.S. Congrats on the work!

    Eitan R
    @erosenberg
    Hey webpack-django people! I'm running into proxy issues with my static assets, similar to this: http://stackoverflow.com/questions/35920691/static-files-not-found-with-webpack-and-django
    I'm trying to load images from my CSS using relative paths, but it believes those images are on my hot-reload server... any ideas?
    Alex Kahn
    @alexkahn
    Hey folks, just wondering if anyone has tried this library with webpack 2?
    Owais Lone
    @owais
    @alexkahn It should work with webpack2. Feel free to file a bug if it doesn't.
    Ian
    @IanT8

    Could someone please explain this code fragment from the webpack.config.js in the examples/hot-reload folder:

    {
      entry: [
          'webpack-dev-server/client?http://localhost:3000',
          'webpack/hot/only-dev-server',
          './assets/js/index'
      ]
    }

    I don't know what the first and second entry points are doing.

    Ian
    @IanT8
    I've got this hot-reload example working, but seems I have to run 3 consoles, (1) webpack --watch (2) python manage.py runserver and (3) node server.js. Is that right? It still doesn't seem to reload when I edit and save the "Hello World" message in assets/js/app.jsx. I'm puzzled.
    Ian
    @IanT8
    I discovered a CORS issue. To fix, I added headers: { "Access-Control-Allow-Origin": "*" } to server.js after the historyApiFallback: true, line.
    Ian
    @IanT8
    And only (1) python manage.py runserver and (2) node server.js are needed.
    François GUÉRIN
    @frague59
    Hi
    I'm new with webpack technology, and I've to upgrade a project to use it
    I've build the site arround jQuery / bootstrap 3, and a custom bunch of css (bs overridings) and js (forms)
    I've followed the http://owaislone.org/blog/webpack-plus-reactjs-and-django/ tutorial, but I does not understand where to put my own assets and how to "ask" to webpack to package them
    François GUÉRIN
    @frague59
    I also use a bunch of django apps, will they be bundled too ?
    Thanks for your help !
    Salar Rahmanian
    @softinio
    @frague59 great question I am trying to figure our the same hope someone here can help
    konoufo
    @konoufo
    It's pretty straight forward, there is an entry property in you webpack config. That's where you list all the files webpack bundles.
    konoufo
    @konoufo
    @frague59 Do you have static files in those django apps that you need to bundle ? If so you'll have to put those paths as well inside the entry property. To know what entryexpects see https://webpack.js.org/concepts/entry-points/
    Salar Rahmanian
    @softinio
    @konoufo do I have to list each file one by one or can I list directories?
    assume in addition to that need to add the appropriate loader like if its css files i need to add the css loader ?