Lint webpack config
This commit is contained in:
parent
de102e2323
commit
7c92149066
6 changed files with 28 additions and 16 deletions
|
@ -14,5 +14,13 @@ module.exports = {
|
|||
},
|
||||
rules: {
|
||||
'prettier/prettier': 'error'
|
||||
},
|
||||
overrides: [
|
||||
{
|
||||
files: ['config/webpack/*.js'],
|
||||
env: {
|
||||
node: true
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
process.env.NODE_ENV = process.env.NODE_ENV || 'development'
|
||||
process.env.NODE_ENV = process.env.NODE_ENV || 'development';
|
||||
|
||||
const environment = require('./environment')
|
||||
const environment = require('./environment');
|
||||
|
||||
module.exports = environment.toWebpackConfig()
|
||||
module.exports = environment.toWebpackConfig();
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
const { environment } = require('@rails/webpacker')
|
||||
const { environment } = require('@rails/webpacker');
|
||||
|
||||
// By default don't transpile JS files in ./node_modules – except for some specific modules.
|
||||
const babelLoader = environment.loaders.get('babel');
|
||||
|
@ -6,8 +6,12 @@ babelLoader.exclude = function(modulePath) {
|
|||
let forcedModules = [
|
||||
'activestorage' // ActiveStorage uses 'class', which is not supported by IE 11 and older Safari version
|
||||
];
|
||||
return modulePath.includes('node_modules')
|
||||
&& forcedModules.every(forcedModule => !modulePath.includes('node_modules/' + forcedModule));
|
||||
}
|
||||
return (
|
||||
modulePath.includes('node_modules') &&
|
||||
forcedModules.every(
|
||||
forcedModule => !modulePath.includes('node_modules/' + forcedModule)
|
||||
)
|
||||
);
|
||||
};
|
||||
|
||||
module.exports = environment
|
||||
module.exports = environment;
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
process.env.NODE_ENV = process.env.NODE_ENV || 'production'
|
||||
process.env.NODE_ENV = process.env.NODE_ENV || 'production';
|
||||
|
||||
const environment = require('./environment')
|
||||
const environment = require('./environment');
|
||||
|
||||
// https://github.com/rails/webpacker/issues/1235
|
||||
environment.config.optimization.minimizer[0].options.uglifyOptions.ecma = 5; // for IE 11 support
|
||||
environment.config.optimization.minimizer[0].options.uglifyOptions.safari10 = true;
|
||||
|
||||
module.exports = environment.toWebpackConfig()
|
||||
module.exports = environment.toWebpackConfig();
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
process.env.NODE_ENV = process.env.NODE_ENV || 'development'
|
||||
process.env.NODE_ENV = process.env.NODE_ENV || 'development';
|
||||
|
||||
const environment = require('./environment')
|
||||
const environment = require('./environment');
|
||||
|
||||
module.exports = environment.toWebpackConfig()
|
||||
module.exports = environment.toWebpackConfig();
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
"webpack-dev-server": "^3.1.4"
|
||||
},
|
||||
"scripts": {
|
||||
"lint:js": "eslint ./app/javascript"
|
||||
"lint:js": "eslint ./app/javascript ./config/webpack"
|
||||
},
|
||||
"engines": {
|
||||
"node": "6.* || 8.* || >= 10.*"
|
||||
|
|
Loading…
Reference in a new issue