Skip to content

Commit

Permalink
webpacker:output - outputs Rails.root
Browse files Browse the repository at this point in the history
this makes the webpacker js config run a rake task to determine `Rails.root`.

It uses that to update the output path, otherwise, output is generated in manageiq-ui-classic/public/ instead of manageiq/public/
  • Loading branch information
himdel committed Aug 3, 2017
1 parent 1d8b60c commit f5f3ce2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
5 changes: 5 additions & 0 deletions config/webpack/configuration.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const { join, resolve } = require('path')
const { env } = require('process')
const { safeLoad } = require('js-yaml')
const { readFileSync } = require('fs')
const { execSync } = require('child_process')

const configPath = resolve('config', 'webpack')
const loadersDir = join(__dirname, 'loaders')
Expand All @@ -12,6 +13,10 @@ const devServer = safeLoad(readFileSync(join(configPath, 'development.server.yml
const publicPath = env.NODE_ENV !== 'production' && devServer.enabled ?
`http://${devServer.host}:${devServer.port}/` : `/${paths.entry}/`

// override paths.output to use Rails.root
const outputPrefix = execSync('rake webpacker:output', { encoding: 'utf8' }).trim();
paths.output = join(outputPrefix, paths.output)

module.exports = {
devServer,
env,
Expand Down
7 changes: 7 additions & 0 deletions lib/tasks/manageiq/ui_tasks.rake
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,10 @@ namespace :webpack do
end
end
end

# needed by config/webpack/configuration.js
namespace :webpacker do
task :output do
puts Rails.root
end
end

0 comments on commit f5f3ce2

Please sign in to comment.