2018-10-09 11:32:27 +02:00
|
|
|
|
const path = require('path');
|
2018-09-12 10:40:12 +02:00
|
|
|
|
const { environment } = require('@rails/webpacker');
|
2018-07-12 11:50:47 +02:00
|
|
|
|
|
2018-08-13 17:14:45 +02:00
|
|
|
|
// By default don't transpile JS files in ./node_modules – except for some specific modules.
|
|
|
|
|
const babelLoader = environment.loaders.get('babel');
|
|
|
|
|
babelLoader.exclude = function(modulePath) {
|
|
|
|
|
let forcedModules = [
|
|
|
|
|
'activestorage' // ActiveStorage uses 'class', which is not supported by IE 11 and older Safari version
|
|
|
|
|
];
|
2018-09-12 10:40:12 +02:00
|
|
|
|
return (
|
|
|
|
|
modulePath.includes('node_modules') &&
|
|
|
|
|
forcedModules.every(
|
|
|
|
|
forcedModule => !modulePath.includes('node_modules/' + forcedModule)
|
|
|
|
|
)
|
|
|
|
|
);
|
|
|
|
|
};
|
2018-08-13 17:14:45 +02:00
|
|
|
|
|
2018-10-09 11:32:27 +02:00
|
|
|
|
const resolve = {
|
|
|
|
|
alias: {
|
|
|
|
|
'@utils': path.resolve(__dirname, '..', '..', 'app/javascript/shared/utils')
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
environment.config.merge({ resolve });
|
|
|
|
|
|
2018-09-12 10:40:12 +02:00
|
|
|
|
module.exports = environment;
|