Webpack loading split chunks relative to main output file - webpack-4

In my project I'm splitting Webpack into different files, the output is going to the web accessible /js directory.
When I import the main.js file and it tries to load the dynamic files I get this error
Error: "Loading chunk controller/About failed.
(error: [...]/controller/About.js)"
Which makes perfect sense, but how can I get Webpack to load that relative to the web /js directory; i.e. I want it to load .../js/controller/About.js instead of .../controller/About.js

Related

error in indirect file load in Informatica

I am trying indirect file load in Informatica.
I put below files in $PmSrcFilesDir (from here the workflow task pick up files)
-list.txt
-production_plan_20210906.csv
-production_plan_20210907.csv
The list.txt files contains the csv file names only.
I configured below options:
Source filetype- Indirect
Source filename- list.txt
Source file directory- $PMSourceFileDir
After running the workflow it shows error- as
FR_3000 Error Opening File...No such file or directory
You can give absolute path in list.txt.
/Path/to/file/production_plan_20210906.csv
/Path/to/file/production_plan_20210907.csv
You can use command task or shell script to get absolute path and file name.
Pls check session log, which file it cant read - list file or main file. If list file mention $PMSourceFileDir correctly in param file.
Now, make sure informatica user (user that runs infa server) has read access to those data, list folders and files. Admin can help.

Rails 4 refresh/autoload list of translations

Our project has translation files that exist in specific branches. Often when switching between branches, I receive the following error:
I18n::InvalidLocaleData
can not load translations from /.../config/locales/feature.yml: #<Errno::ENOENT: No such file or directory # rb_sysopen - /.../config/locales/feature.yml>
I can fix this by restarting the server, but I was wondering if there is a way to (in development) have rails watch the locales folder to check for added/removed files.

Replace text in broccoli-imported css file / ember-cli app

I am currently importing a css file from my bower_components folder in an ember-cli application, e.g.:
app.import('bower_components/toastr/toastr.min.css');
I'd like to modify the CSS in that file before it gets concatenated into vendor.css. How can I do a find a replace so that it ends up in vendor.css?
At this point, I've explored broccoli-replace a bit, but seems that that would only work if I wanted to have toastr.min built as a separate file in my dist folder. I'm not 100% understanding broccoli at the moment, so this could be way off.

Django: directory structure

Let's say I have a Django project myproj, with an app myapp. In myproj/myapp, there is a file called const.py, which is included in the app's views file, and loads some constants from a text file. This text file is located at myproj/myapp/myfile.txt.
In const.py, the following code works fine when the web server is operating:
with open('myapp/myfile.txt')
But if I move to the directory myproj/myapp and from the command line run python const.py, I get an error saying that it cannot find the file myapp/myfile.txt. In order to make it work from the command line, I have to change const.py to:
with open('myfile.txt')
However, this then does not work for the web server. I understand why the first version doesn't work from the command line. But what I don't understand is why the first version works when the web server is running, whilst the second version doesn't. If const.py is in the same directory as myfile.txt, then surely the web server will search that same directory for myfile.txt. Why is it not finding it then? And why, when it searches for myapp/myfile.txt can it find a file, which is in the same directory as const.py?
Thanks!

What should my LESS #import path be?

Here's the scenario:
I'm running Django 1.3.1, utilizing staticfiles, and django-compressor (latest stable) to, among other things, compile LESS files.
I have an "assets" directory that's hooked into staticfiles with STATICFILES_DIRS (for project-wide static resources). In that directory I have a "css" directory and in that a "lib.less" file that contains LESS variables and mixins.
So the physical path is <project_root>/assets/css/lib.less and it's served at /static/css/lib.less.
In one of my apps' static directory, I have another LESS file that needs to import the one above. The physical path for that is <project_root>/myapp/static/myapp/css/file.less and it would be served at /static/myapp/css/file.less.
My first thought was:
#import "../../css/lib.less"
(i.e. based on the URL, go up to levels from /static/myapp/css to /static/, then traverse down into /static/css/lib.less).
However, that doesn't work, and I've tried just about every combination of URLs and physical paths I can think of and all of them give me FilterErrors in the template, resulting from not being able to find the file to import.
Anyone have any ideas what the actual import path should be?
After tracking down exactly where the error was coming from in the django-compressor source. It turns out to be directly passed from the shell. Which clued me into removing all the variables and literally just trying to get the lessc compiler to parse the file.
Turns out it wants a relative path from the source file to the file to be imported in terms of the physical filesystem path. So I had to back all the way out to my <project_root> and then reference assets/css/lib.less from there. The actual import that finally worked was:
#import "../../../../assets/css/lib.less"
What's very odd though is that lessc would not accept an absolute filesystem path (i.e. /path/to/project/assets/css/lib.less). I'm not sure why.
UPDATE (02/08/2012)
Had a complete "DUH" moment when I finally pushed my code to my staging environment and ran collectstatic. The #import path I was using worked fine in development because that was the physical path to the file then, but once collectstatic has done it's thing, everything is moved around and relative to <project_root>/static/.
I toyed with the idea of using symbolic links to try to match up the pre and post-collectstatic #import paths, but I decided that that was far too complicated and fragile in the long run.
SO... I broke down and moved all the LESS files together under <project_root>/assets/css/, and rationalized moving the LESS files out of the apps because since they're tied to a project-level file in order to function, they're inherently project-level themselves.
I'm sort of in the same bind and this is what I've come up with for the most recent versions of compressor and lessc to integrate with staticfiles. Hopefully this will help some other people out
As far as I can tell from experimenting, lessc doesn't have a notion of absolute or relative paths. Rather, it seems to maintain a search path, which includes the current directory, the containing directory of the less file, and whatever you pass to it via --include-path
so in my configuration for compressor I put
COMPRESS_PRECOMPILERS = (
('text/less', 'lessc --include-path=%s {infile} {outfile}' % STATIC_ROOT),
)
Say, after running collectstatic I have bootstrap living at
STATIC_ROOT/bootstrap/3.2.0/bootstrap.css.
Then from any less file, I can now write
#import (less, reference) "/bootstrap/3.2.0/bootstrap.css"
which allows me to use the bootstrap classes as less mixins in any of my less files!
Every time I update a less file, I have to run collectstatic to aggregate them in a local directory so that compressor can give less the right source files to work on. Otherwise, compressor handles everything smoothly. You can also use collectstatic -l to symlink, which means you only need to collect the files when you add a new one.
I'm considering implementing a management command to smooth out the development process that either subclasses runserver to call collectstatic each time the server is reloaded, or uses django.utils.autoreload directly to call collectstatic when things are updated.
Edit (2014/12/01): My approach as outlined above requires a local static root. I was using remote storage with offline compression in my production environment, so deployment requires a couple extra steps. In addition to calling collectstatic to sync the static files to the remote storage, I call collectstatic with different django config file that uses local storage. After I have collected the files locally, I can call 'compress', having configured it to upload the result files to remote storage, but look in local storage for source files.