const path = require('path');
const log = require('debug')('webpack.config');
const webpack = require('webpack');
module.exports = (env) => {
log('env', env);
return {
entry: {
main: [
'./client/main.js',
'./client/main.css'
]
},
output: {
publicPath: env.public,
filename: 'scripts/[name].js',
path: `${path.resolve('./dist')}/static/theme`
},
devServer: {
hot: true,
contentBase: './dist',
port: env.port,
host: "0.0.0.0",
proxy: {
"/": {
secure: false,
changeOrigin: true,
autoRewrite: true,
headers: {
'X-ProxiedBy-Webpack': true,
},
target: 'http://mysite.by',
bypass (request, response, options) {
const asset = request.path;
console.log(asset);
// yesno if the requested path is one of the following.
const byPass = [
env.public,
'/webpack-dev-middleware/',
'/webpack-dev-server/',
'/sockjs-node/',
'/socket.io/',
].find(pattern => asset.indexOf(pattern) >= 0 ) !== undefined;
return byPass && request.path;
}
},
}
},
module: {
rules: [
{ test: /\.css$/,
use: [
{loader: 'style-loader'},
{loader: 'css-loader'}
]
}
]
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
]
}
};
BobRay Reply #3, 3 years, 1 month ago
I tried creating a fairly complex static TV and I can tell you that its file contains nothing but the default value of the TV. The files for static elements are meant to hold only the 'content' of the element (e.g., the text of a chunks and templates, and the code of a snippets or plugins).
Given that only the default value of the TV is saved, there's usually no point in having a TV be a static element unless its default value is a fair amount of text.
I don't think the static nature of your TVs is the problem. More likely it's a nesting/cache issue. For example, if your TV tag is inside a snippet tag that's inside a chunk and the chunk tag is in a template or another chunk, MODX can have trouble with it since the TV tag may not be parsed at the point that it's used.
Also, if the TV tag is unparsed (with a !), that delays its processing so that its value may not be available when the tag it's in is parsed.
Feel free to post a TV tag that your having trouble with.
<form action="" method="post" class="ajax_form af_example">
<div class="form-group">
<label class="control-label" for="af_name">[[%af_label_name]]</label>
<div class="controls">
<input type="text" id="af_name" name="name" value="[[+fi.name]]" placeholder="" class="form-control"/>
<span class="error_name">[[+fi.error.name]]</span>
</div>
</div>
<div class="form-group">
<label class="control-label" for="af_email">[[%af_label_email]]</label>
<div class="controls">
<input type="email" id="af_email" name="email" value="[[+fi.email]]" placeholder="" class="form-control"/>
<span class="error_email">[[+fi.error.email]]</span>
</div>
</div>
<div class="form-group">
<label class="control-label" for="af_message">[[%af_label_message]]</label>
<div class="controls">
<textarea id="af_message" name="message" class="form-control" rows="5">[[+fi.message]]</textarea>
<span class="error_message">[[+fi.error.message]]</span>
</div>
</div>
<div class="form-group">
<div class="controls">
<button type="reset" class="btn btn-default">[[%af_reset]]</button>
<button type="submit" class="btn btn-primary">[[%af_submit]]</button>
</div>
</div>
[[+fi.success:is=`1`:then=`
<div class="alert alert-success">[[+fi.successMessage]]</div>
`]]
[[+fi.validation_error:is=`1`:then=`
<div class="alert alert-danger">[[+fi.validation_error_message]]</div>
`]]
</form>