Webpacker: How to add custom alias.

Created on 5 May 2018  路  2Comments  路  Source: rails/webpacker

Hi, I want to add some custom alias as I used did in webpack.

I checked with this https://github.com/rails/webpacker/blob/master/docs/webpack.md#configuration,
but seems when I call environment.config.merge(), it's actually not a function.

So except I did something like this.

// config/webpack/development.js(test.js/prod.js as well)

const custom = require('./custom');
const env = require('./environment');
const _ = require('lodash')

const mergedConfig = _.merge(env.toWebpackConfig(), custom);
module.export= mergedConfig;

Is there any formal way I can merge my custom alias?
Thanks

Most helpful comment

All 2 comments

@hateonion did you want to add some alias like:
'@': 'app/javascript/src'

Have you find how to config this ?

Was this page helpful?
0 / 5 - 0 ratings