11import json
22import os
33import re
4- import tempfile
54from optional_django import staticfiles
65from webpack .compiler import webpack
76from webpack .config_file import ConfigFile , JS
@@ -39,7 +38,9 @@ def get_path_to_config_file(config_file, prefix=None):
3938def generate_config_file (config ):
4039 return ConfigFile (
4140 JS ('var path = require("path");\n ' ),
42- JS ('module.exports = ' ), config , JS (';' ),
41+ JS ('module.exports = ' ),
42+ config ,
43+ JS (';' ),
4344 )
4445
4546
@@ -57,9 +58,9 @@ def generate_config_for_component(path, translate=None, path_to_react=None, devt
5758
5859 config = {
5960 'context' : js_path_join (os .path .dirname (path )),
60- 'entry' : '.' + os . path . sep + os .path .basename (path ),
61+ 'entry' : './{}' . format ( os .path .basename (path ) ),
6162 'output' : {
62- 'path' : '[bundle_dir]/react- components' ,
63+ 'path' : js_path_join ( os . path . join ( '[bundle_dir]' , ' components')) ,
6364 'filename' : var + '-[hash].js' ,
6465 'libraryTarget' : 'umd' ,
6566 'library' : var
@@ -77,12 +78,10 @@ def generate_config_for_component(path, translate=None, path_to_react=None, devt
7778 }
7879
7980 if translate :
80- translate_test = settings .TRANSLATE_TEST or '/.jsx$/'
81-
8281 config .update ({
8382 'module' : {
8483 'loaders' : [{
85- 'test' : JS (translate_test ),
84+ 'test' : JS (settings . TRANSLATE_TEST ),
8685 'exclude' : JS ('/node_modules/' ),
8786 'loader' : 'babel-loader'
8887 }]
0 commit comments