2022-03-09 17:37:59 +01:00
|
|
|
const { webpackConfig, merge } = require('shakapacker');
|
2022-03-14 13:59:57 +01:00
|
|
|
const webpack = require('webpack');
|
|
|
|
const path = require('path');
|
|
|
|
|
2022-03-15 09:51:39 +01:00
|
|
|
const htmlErb = require('./modules/html_erb');
|
|
|
|
const jsErb = require('./modules/js_erb');
|
|
|
|
const sass = require('./modules/sass');
|
|
|
|
const sassErb = require('./modules/sass_erb');
|
|
|
|
const html = require('./modules/html');
|
|
|
|
const uiTour = require('./modules/ui-tour');
|
2022-03-15 11:13:03 +01:00
|
|
|
const hmr = require('./modules/hmr');
|
|
|
|
|
|
|
|
const isDevelopment = process.env.NODE_ENV !== 'production';
|
2022-03-09 16:31:38 +01:00
|
|
|
|
|
|
|
// See the shakacode/shakapacker README and docs directory for advice on customizing your webpackConfig.
|
2022-03-09 17:37:59 +01:00
|
|
|
const customConfig = {
|
2022-03-14 13:59:57 +01:00
|
|
|
plugins: [
|
|
|
|
new webpack.ProvidePlugin({
|
|
|
|
$: 'jquery',
|
|
|
|
jQuery: 'jquery',
|
|
|
|
'window.jQuery': 'jquery',
|
|
|
|
_: 'lodash',
|
|
|
|
Hone: 'hone',
|
|
|
|
Tether: 'tether',
|
|
|
|
Holder: 'holderjs',
|
|
|
|
'window.CodeMirror': 'codemirror',
|
|
|
|
MediumEditor: 'medium-editor',
|
|
|
|
Humanize: path.resolve(path.join(__dirname, '../../app/frontend/src/javascript/lib/humanize.js')),
|
2022-03-21 17:59:38 +01:00
|
|
|
GTM: path.resolve(path.join(__dirname, '../../app/frontend/src/javascript/lib/gtm.js')),
|
2022-03-14 13:59:57 +01:00
|
|
|
moment: 'moment',
|
2022-03-15 11:13:03 +01:00
|
|
|
Application: [path.resolve(path.join(__dirname, '../../app/frontend/src/javascript/app.js')), 'Application'],
|
|
|
|
process: 'process/browser'
|
|
|
|
}),
|
2022-03-23 11:54:39 +01:00
|
|
|
isDevelopment && new (require('@pmmmwh/react-refresh-webpack-plugin'))()
|
2022-03-22 20:09:19 +01:00
|
|
|
].filter(Boolean),
|
2022-03-14 13:59:57 +01:00
|
|
|
module: {
|
|
|
|
rules: [
|
|
|
|
jsErb,
|
|
|
|
htmlErb,
|
|
|
|
sassErb,
|
|
|
|
html,
|
|
|
|
sass,
|
2022-03-15 11:13:03 +01:00
|
|
|
uiTour,
|
|
|
|
hmr
|
2022-03-14 13:59:57 +01:00
|
|
|
]
|
|
|
|
},
|
2022-03-09 17:37:59 +01:00
|
|
|
resolve: {
|
2022-03-14 13:59:57 +01:00
|
|
|
extensions: ['.jpg', '.jpeg', '.png', '.gif', '.tiff', '.ico',
|
|
|
|
'.svg', '.eot', '.otf', '.ttf', '.woff', '.woff2',
|
|
|
|
'.tsx', '.ts', '.erb', '.html', '.mjs', '.js', '.jsx',
|
2022-03-14 14:52:23 +01:00
|
|
|
'.sass', '.scss', '.css', '.module.sass', '.module.scss', '.module.css'],
|
|
|
|
fallback: {
|
2022-03-15 11:13:03 +01:00
|
|
|
assert: require.resolve('assert')
|
2022-03-14 14:52:23 +01:00
|
|
|
}
|
2022-03-09 17:37:59 +01:00
|
|
|
}
|
|
|
|
};
|
2022-03-09 16:31:38 +01:00
|
|
|
|
2022-03-09 17:37:59 +01:00
|
|
|
module.exports = merge(webpackConfig, customConfig);
|