Skip to content

Commit

Permalink
UJ: Merged from template.
Browse files Browse the repository at this point in the history
  • Loading branch information
ianwieds committed Nov 8, 2023
2 parents 31855c7 + 0216207 commit 9366326
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 23 deletions.
30 changes: 15 additions & 15 deletions _websrc/master.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,23 @@ module.exports = {

browsersync: {
browsers: [
// "Google Chrome Canary",
// "Google Chrome",
// "Firefox Nightly",
// "Firefox Developer Edition",
// "Firefox",
// "Safari Technology Preview",
// "Safari",
// "Opera",
// "Opera Developer",
// 'Google Chrome Canary',
// 'Google Chrome',
// 'Firefox Nightly',
// 'Firefox Developer Edition',
// 'Firefox',
// 'Safari Technology Preview',
// 'Safari',
// 'Opera',
// 'Opera Developer',
],
},

eslintLoader: {
enforce: "pre",
enforce: 'pre',
test: /\.js$/,
exclude: /node_modules/,
loader: "eslint-loader",
loader: 'eslint-loader',
},

imagemin: {
Expand Down Expand Up @@ -86,15 +86,15 @@ module.exports = {

babel: {
presets: [
["@babel/preset-env", {
['@babel/preset-env', {
modules: false,
targets: {
browsers: [
"last 2 versions",
"IE >= 9"
'last 2 versions',
'IE >= 9'
]
},
useBuiltIns: "usage",
useBuiltIns: 'usage',
}]
]
},
Expand Down
28 changes: 20 additions & 8 deletions _websrc/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ const path = require('path');
// const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
const TerserPlugin = require('terser-webpack-plugin');
const argv = require('yargs').argv;
const timestamp = new Date().getTime();
const yaml = require('js-yaml');
const jetpack = require('fs-jetpack');

const tools = new (require('./libraries/tools.js'));
const configYML = yaml.load(jetpack.read('_config.yml'));

module.exports = {
mode: 'production',
Expand All @@ -22,8 +26,8 @@ module.exports = {
rules: [
{
test: /\.js$/,
use: ["source-map-loader"],
enforce: "pre"
use: ['source-map-loader'],
enforce: 'pre',
}
]
},
Expand All @@ -40,7 +44,8 @@ module.exports = {
// chunkFilename: './assets/js/[name].js',
// chunkFilename: '[name].js',
// path: '/assets/js/',
publicPath: '/assets/js/',
// publicPath: '/assets/js/',
publicPath: `${tools.isServer ? configYML.url : ''}/assets/js/`,
// filename: '[name].js'

// https://github.com/webpack/webpack/issues/959
Expand All @@ -50,15 +55,15 @@ module.exports = {
},
filename: (pathData) => {
return '[name].js';
},
},

// https://github.com/webpack/webpack/issues/2329
// chunkFilename: `chunk.[name].[chunkhash].js?cb=[chunkhash]`,
// chunkFilename: `chunk.[name].[chunkhash].js?cb=[chunkhash]`,


// https://stackoverflow.com/questions/39238163/how-to-use-cache-busting-with-webpack
// filename: `[name].js?cb=${timestamp}`,
// chunkFilename: `chunk.[name].js?cb=${timestamp}`,
// chunkFilename: `chunk.[name].js?cb=${timestamp}`,
// path: '/assets/js/',

// umdNamedDefine: false,
Expand Down Expand Up @@ -96,6 +101,13 @@ module.exports = {
// usedExports: false,
},

plugins: [
// This makes it possible for us to safely use env vars on our code
// new webpack.DefinePlugin({
// 'process.env.ASSET_PATH': JSON.stringify(ASSET_PATH),
// }),
],

/* CRITICAL CSS */
// plugins: [
// new CriticalPlugin({
Expand Down

0 comments on commit 9366326

Please sign in to comment.