Fix bin/publish: use correct .env path for rspade_system Fix bin/publish script: prevent grep exit code 1 from terminating script 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
83 lines
2.3 KiB
JavaScript
Executable File
83 lines
2.3 KiB
JavaScript
Executable File
/**
|
|
* JQHTML Webpack Configuration Helper
|
|
*
|
|
* Provides easy setup for JQHTML in webpack projects:
|
|
*
|
|
* const { addJQHTMLSupport } = require('@jqhtml/webpack-loader');
|
|
* module.exports = addJQHTMLSupport(webpackConfig);
|
|
*/
|
|
/**
|
|
* Create webpack rule for .jqhtml files
|
|
*/
|
|
export function createJQHTMLRule(options = {}) {
|
|
return {
|
|
test: options.test || /\.jqhtml$/,
|
|
use: [
|
|
{
|
|
loader: '@jqhtml/webpack-loader',
|
|
options: {
|
|
sourceMap: options.sourceMap ?? true
|
|
}
|
|
}
|
|
],
|
|
type: 'javascript/auto'
|
|
};
|
|
}
|
|
/**
|
|
* Add JQHTML support to existing webpack config
|
|
*/
|
|
export function addJQHTMLSupport(config, options) {
|
|
// Ensure module.rules exists
|
|
if (!config.module) {
|
|
config.module = {};
|
|
}
|
|
if (!config.module.rules) {
|
|
config.module.rules = [];
|
|
}
|
|
// Add JQHTML rule
|
|
config.module.rules.push(createJQHTMLRule(options));
|
|
// Add .jqhtml to resolve extensions if not present
|
|
if (!config.resolve) {
|
|
config.resolve = {};
|
|
}
|
|
if (!config.resolve.extensions) {
|
|
config.resolve.extensions = ['.js', '.ts', '.json'];
|
|
}
|
|
if (!config.resolve.extensions.includes('.jqhtml')) {
|
|
config.resolve.extensions.push('.jqhtml');
|
|
}
|
|
return config;
|
|
}
|
|
/**
|
|
* Standalone webpack config for JQHTML projects
|
|
*/
|
|
export function createJQHTMLConfig(options = { entry: './src/index.js' }) {
|
|
return {
|
|
mode: options.mode || 'development',
|
|
entry: options.entry,
|
|
output: options.output || {
|
|
filename: 'bundle.js',
|
|
path: process.cwd() + '/dist'
|
|
},
|
|
module: {
|
|
rules: [
|
|
createJQHTMLRule({ sourceMap: options.sourceMap }),
|
|
{
|
|
test: /\.js$/,
|
|
exclude: /node_modules/,
|
|
use: {
|
|
loader: 'babel-loader',
|
|
options: {
|
|
presets: ['@babel/preset-env']
|
|
}
|
|
}
|
|
}
|
|
]
|
|
},
|
|
resolve: {
|
|
extensions: ['.js', '.jqhtml', '.json']
|
|
},
|
|
devtool: options.sourceMap !== false ? 'source-map' : false
|
|
};
|
|
}
|
|
//# sourceMappingURL=webpack-config.js.map
|