mirror of
https://github.com/astuto/astuto.git
synced 2025-12-15 19:27:52 +01:00
* Install jsbundling-rails, uninstall rails/webpacker * Remove outdated step from run-tests workflow * Use cssbundling-rails for CSS
54 lines
1.1 KiB
JavaScript
54 lines
1.1 KiB
JavaScript
const path = require("path")
|
|
const webpack = require("webpack")
|
|
|
|
const mode = process.env.NODE_ENV === 'development' ? 'development' : 'production';
|
|
|
|
module.exports = {
|
|
mode: mode,
|
|
|
|
optimization: {
|
|
moduleIds: 'deterministic',
|
|
},
|
|
entry: {
|
|
application: "./app/javascript/application.js"
|
|
},
|
|
output: {
|
|
filename: "[name].js",
|
|
sourceMapFilename: "[file].map",
|
|
path: path.resolve(__dirname, "..", "..", "app/assets/builds"),
|
|
},
|
|
resolve: {
|
|
extensions: ['.js', '.jsx', '.ts', '.tsx'],
|
|
},
|
|
module: {
|
|
rules: [
|
|
{
|
|
test: /\.(js|jsx|ts|tsx)$/,
|
|
exclude: /node_modules/,
|
|
use: ['babel-loader']
|
|
},
|
|
{
|
|
test: /\.erb$/,
|
|
enforce: 'pre',
|
|
exclude: /node_modules/,
|
|
use: [{
|
|
loader: 'rails-erb-loader',
|
|
options: {
|
|
runner: (/^win/.test(process.platform) ? 'ruby ' : '') + 'bin/rails runner'
|
|
}
|
|
}]
|
|
}
|
|
]
|
|
},
|
|
plugins: [
|
|
new webpack.optimize.LimitChunkCountPlugin({
|
|
maxChunks: 1
|
|
}),
|
|
new webpack.ProvidePlugin({
|
|
$: 'jquery',
|
|
jQuery: 'jquery',
|
|
Popper: ['popper.js', 'default']
|
|
})
|
|
]
|
|
}
|