Closed amoshydra closed 6 years ago
https://github.com/vigetlabs/blendid/blob/master/gulpfile.js/lib/webpack-multi-config.js#L19
const jsSrc = path.resolve(process.env.PWD, PATH_CONFIG.src, PATH_CONFIG.javascripts.src)
const jsDest = path.resolve(process.env.PWD, PATH_CONFIG.dest, PATH_CONFIG.javascripts.dest)
const publicPath = pathToUrl(TASK_CONFIG.javascripts.publicPath || PATH_CONFIG.javascripts.dest, '/')
const rev = TASK_CONFIG.production.rev && env === 'production'
I have always thought that if we didn't define the publicPath
in TASK_CONFIG, it will be default to
PATH_CONFIG.dest + PATH_CONFIG.javascript.dest + /
.
Apparently that is not the case in here.
My current workaround for this is to change the publicPath during development
customizeWebpackConfig(webpackConfig, env, webpack) {
if (env === 'development') {
const publicPath = path.join(config.dest.replace('./public/', ''), config.javascripts.dest, '/');
webpackConfig.output.publicPath = publicPath;
}
It looks like the publicPath is incorrectly set for production env too: publicPath === javascripts/
. However, this does not affect the output of the assets file and manifest as they will be using jsDest
.
So I could actually specify the publicPath
like this inside task-config directly
publicPath: path.join(config.dest.replace('./public/', ''), config.javascripts.dest, '/'),
Does not work for me either. When I run rails s
and yarn run blendid
, localhost:3001
has no access to the app.js
file.
@amoshydra: Unfortunately your solution didn't help me. Does it still work for you?
I'm on:
rails 5.1.3
blendid 4.2.0
Nevermind, it's working on default config now, but I'm not sure why.
Related to https://github.com/vigetlabs/blendid/issues/330 I am having problem with getting the
app.js
also using Blendid v4.1.1yarn run blendid -- build
is able to produce the correctasset_path
@ http://localhost:3000/assets/gulp/javascripts/app.jsIn development, the browser is expecting the
app.js
from the same path (http://localhost:3001/assets/gulp/javascripts/app.js) also. However it is not available (404).The
app.js
is however accessible fromlocalhost:3001/javascripts/app.js
path-config.json
The only thing I customise from the webpack config is
webpackConfig.resolve.modules
Other details: