Add support for running CodeOcean under a subpath
* Also refactor (JavaScript) routes
This commit is contained in:
@ -4,8 +4,8 @@ Info for this file can be found
|
||||
github.com/rails/webpacker/blob/master/docs/webpack.md
|
||||
*/
|
||||
|
||||
const { environment } = require('@rails/webpacker')
|
||||
const { merge } = require('webpack-merge')
|
||||
const {environment} = require('@rails/webpacker')
|
||||
const {merge} = require('webpack-merge')
|
||||
const webpack = require('webpack')
|
||||
const erb = require('./loaders/erb')
|
||||
|
||||
@ -25,6 +25,14 @@ environment.plugins.prepend('Provide', new webpack.ProvidePlugin({
|
||||
})
|
||||
)
|
||||
|
||||
// This setting will change the absolute path used to refer
|
||||
// external files (images, fonts, ...) in the generated assets
|
||||
const relative_url_root = process.env.RAILS_RELATIVE_URL_ROOT || '';
|
||||
const public_output_path = environment.config.output.publicPath;
|
||||
environment.loaders.get('file')
|
||||
.use.find(item => item.loader === 'file-loader')
|
||||
.options.publicPath = relative_url_root + public_output_path;
|
||||
|
||||
environment.loaders.append('erb', erb)
|
||||
|
||||
const envConfig = module.exports = environment
|
||||
|
Reference in New Issue
Block a user