Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
console.log('Source Folder:', srcFolder);
console.log('Output Folder:', distFolder);
console.log('isProduction:', isProduction);
console.log('isProfiling:', isProfiling);
const cssVarsFiles = [
'../src/Styles/Variables/colors',
'../src/Styles/Variables/dimensions',
'../src/Styles/Variables/fonts',
'../src/Styles/Variables/animations',
'../src/Styles/Variables/zIndexes'
].map(require.resolve);
// Override the way HtmlWebpackPlugin injects the scripts
HtmlWebpackPlugin.prototype.injectAssetsIntoHtml = function(html, assets, assetTags) {
const head = assetTags.head.map((v) => {
v.attributes = { rel: 'stylesheet', type: 'text/css', href: `/${v.attributes.href.replace('\\', '/')}` };
return this.createHtmlTag(v);
});
const body = assetTags.body.map((v) => {
v.attributes = { src: `/${v.attributes.src}` };
return this.createHtmlTag(v);
});
return html
.replace('', head.join('\r\n '))
.replace('', body.join('\r\n '));
};
const plugins = [
new OptimizeCssAssetsPlugin({}),
if (process.env.SUBSCHEMA_USE_HTML) {
opts.useHtml = true;
console.warn(`using html plugin`);
function charset(ele) {
if (!ele.attributes) {
ele.attributes = {};
}
if (!ele.attributes.charset) {
ele.attributes.charset = 'UTF-8';
}
}
var HtmlWebpackPlugin = require(
'html-webpack-plugin');
var ogenerateAssetTags = HtmlWebpackPlugin.prototype.generateAssetTags;
HtmlWebpackPlugin.prototype.generateAssetTags = function (assets) {
var ret = ogenerateAssetTags.call(this, assets);
ret.body.forEach(charset);
ret.head.forEach(charset);
return ret;
};
if (opts.useNameHash) {
webpack.devtool = 'source-map';
} else {
webpack.devtool = 'inline-source-map';
}
plugins.push(new HtmlWebpackPlugin({
'title' : (deps.description ? deps.description : deps.name),
'hash' : opts.useNameHash,
'template': path.resolve(__dirname, 'public',
opts.analytics ? 'index_analytics.ejs' : 'index.ejs'),
'filename': 'index.html',
if (process.env.SUBSCHEMA_USE_HTML) {
opts.useHtml = true;
console.warn(`using html plugin`);
function charset(ele) {
if (!ele.attributes) {
ele.attributes = {};
}
if (!ele.attributes.charset) {
ele.attributes.charset = 'UTF-8';
}
}
var HtmlWebpackPlugin = require(
'html-webpack-plugin');
var ogenerateAssetTags = HtmlWebpackPlugin.prototype.generateAssetTags;
HtmlWebpackPlugin.prototype.generateAssetTags = function (assets) {
var ret = ogenerateAssetTags.call(this, assets);
ret.body.forEach(charset);
ret.head.forEach(charset);
return ret;
};
if (opts.useNameHash) {
webpack.devtool = 'source-map';
} else {
webpack.devtool = 'inline-source-map';
}
plugins.push(new HtmlWebpackPlugin({
'title' : (deps.description ? deps.description : deps.name),
'hash' : opts.useNameHash,
'template': path.resolve(__dirname, 'public',
opts.analytics ? 'index_analytics.ejs' : 'index.ejs'),
)
let html = compiled({
htmlWebpackPlugin: {
options: cfg.__html.variables
}
})
const data = { body: [], head: [] }
fillHtmlTags(data, cfg)
if (cfg.ctx.mode.pwa) {
fillPwaTags(data, cfg)
}
html = HtmlWebpackPlugin.prototype.injectAssetsIntoHtml(html, {}, data)
html = injectSsrInterpolation(html)
if (cfg.build.minify) {
const { minify } = require('html-minifier')
html = minify(html, Object.assign({}, cfg.__html.minifyOptions, {
ignoreCustomComments: [ /vue-ssr-outlet/ ],
ignoreCustomFragments: [ /{{ [\s\S]*? }}/ ]
}))
}
return html
}
template.replace('<div id="q-app"></div>', '')
)
let html = compiled({
htmlWebpackPlugin: {
options: cfg.__html.variables
}
})
const data = { body: [], head: [] }
if (cfg.ctx.mode.pwa) {
fillPwaTags(data, cfg)
}
if (data.body.length > 0 || data.head.length > 0) {
html = HtmlWebpackPlugin.prototype.injectAssetsIntoHtml(html, {}, data)
}
html = injectSsrInterpolation(html)
if (cfg.build.appBase) {
html = fillBaseTag(html, cfg.build.appBase)
}
if (cfg.build.minify) {
const { minify } = require('html-minifier')
html = minify(html, {
...cfg.__html.minifyOptions,
ignoreCustomComments: [ /vue-ssr-outlet/ ],
ignoreCustomFragments: [ /{{ [\s\S]*? }}/ ]
})
}