Webpack does not reflect changes in js files with reaction and django

I am trying to create an application with Backact Frontend and Django Rest Framework. I use webpack_loader and follow the instructions on the Internet to configure it. I serve static files from Amazon CDN, but my local changes in js files are not reflected during local testing with python manage.py run server webpack.config.js

var debug = process.env.NODE_ENV !== "production";
var webpack = require('webpack');
var path = require('path');
var BundleTracker = require('webpack-bundle-tracker');

module.exports = {
  context: path.join(__dirname, "src"),
  devtool: debug ? "inline-sourcemap" : null,
  entry: {
      index: ["./js/index.js"],
      explore: ["./js/explore.js"],
      post: ["./js/post.js"]
  },
  module: {
    loaders: [
      {
        test: /\.jsx?$/,
        exclude: /(node_modules|bower_components)/,
        loader: 'babel-loader',
        query: {
          presets: ['react', 'es2015', 'stage-0'],
          plugins: ['react-html-attrs', 'transform-class-properties', 'transform-decorators-legacy'],
        }
      }
    ]
  },
  output: {
    path: __dirname + "/src/bundle",
    filename: "[name].min.js",
    publicPath: "/src/bundle/",
  },
  plugins: [
    new webpack.optimize.DedupePlugin(),
    new webpack.optimize.OccurenceOrderPlugin(),
    new webpack.optimize.UglifyJsPlugin({ mangle: false, sourcemap: false }),
    new webpack.optimize.CommonsChunkPlugin('vendors', 'vendors.js'),
    new BundleTracker({filename: './webpack-stats.json'}),
  ],
};

What i ran

node_modules/.bin/webpack --config webpack.config.js
python manage.py collectstatic --noinput -i node_modules

which collects static files on a CDN. I double-checked that both vendors.js and index.min.js are correct on the CDN and do not contain the old url that I changed. Now I am really confused why he is still able to display old things.

"Header.js" locally:

<img className="logo"src="https://d3h7hz7pb749sg.cloudfront.net/static/src/binary/icon/logo.png" alt="Pique Logo" draggable="false" />

But when running on the server:

But when starting the server

+4
source share
1 answer

, , . , CDN js , , , . , , js , CDN .

+1

Source: https://habr.com/ru/post/1695416/


All Articles