connector-wordpress/webpack.config.cjs

47 lines
911 B
JavaScript
Raw Normal View History

2021-12-09 19:46:19 +01:00
/* eslint-disable no-undef */
const path = require('path')
2021-12-09 19:46:19 +01:00
const CopyPlugin = require('copy-webpack-plugin')
2021-12-09 19:46:19 +01:00
const FOLDER_SOURCE = './source'
module.exports = {
2021-12-14 15:33:07 +01:00
entry: {
2021-12-14 17:54:47 +01:00
'block-events-loader': FOLDER_SOURCE + '/front/block-events-loader.js',
2021-12-14 15:33:07 +01:00
},
output: {
2021-12-14 15:33:07 +01:00
filename: '[name].js',
2021-12-14 17:54:47 +01:00
path: path.resolve(__dirname, 'build/front'),
},
2022-01-09 12:35:26 +01:00
module: {
rules: [
{
test: /\.m?js$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {
presets: [['@babel/preset-env', { targets: 'defaults' }]],
},
},
},
],
},
plugins: [
new CopyPlugin({
patterns: [
{
2021-12-14 17:51:13 +01:00
context: FOLDER_SOURCE,
from: '**/*.php',
to: '../',
},
{
2021-12-14 17:51:13 +01:00
context: FOLDER_SOURCE,
from: '**/*.txt',
to: '../',
},
],
}),
],
2021-12-09 19:46:19 +01:00
}