diff --git a/webmaker/package.json b/webmaker/package.json index 3e5abea..0ae44c6 100644 --- a/webmaker/package.json +++ b/webmaker/package.json @@ -29,6 +29,7 @@ "dependencies": { "@emmetio/codemirror-plugin": "^0.5.4", "codemirror": "^5.37.0", + "copy-webpack-plugin": "^4.5.1", "esprima": "^4.0.0", "firebase": "^5.0.4", "preact": "^8.2.6", diff --git a/webmaker/preact.config.js b/webmaker/preact.config.js new file mode 100644 index 0000000..83145e3 --- /dev/null +++ b/webmaker/preact.config.js @@ -0,0 +1,53 @@ +import CopyWebpackPlugin from 'copy-webpack-plugin' + +/** + * Function that mutates original webpack config. + * Supports asynchronous changes when promise is returned. + * + * @param {object} config - original webpack config. + * @param {object} env - options passed to CLI. + * @param {WebpackConfigHelpers} helpers - object with useful helpers when working with config. + **/ +export default function (config, env, helpers) { + if (env.isProd) { + config.devtool = false; // disable sourcemaps + } + config.plugins.push(new CopyWebpackPlugin([{ + context: `${__dirname}/src/assets`, + from: `*.*` + }, { + from: `${__dirname}/src/lib`, + to: 'lib/' + }, + { + from: `${__dirname}/src/detached-window.js` + }, + { + from: `${__dirname}/src/*.ttf` + }, + { + from: `${__dirname}/src/patreon.png` + }, + { + from: `${__dirname}/src/preview.html` + }, + { + from: `${__dirname}/src/style.css` + } + ])); + + // let plugins = helpers.getPlugins(); + // console.log(helpers.getPlugins(config)); + + const { + plugin + } = helpers.getPluginsByName(config, 'SWPrecacheWebpackPlugin')[0]; + console.log(plugin) + plugin.options.maximumFileSizeToCacheInBytes = 2900000; + + + let { + index + } = helpers.getPluginsByName(config, 'UglifyJsPlugin')[0] + config.plugins.splice(index, 1) +} diff --git a/webmaker/src/components/SavedItemPane.jsx b/webmaker/src/components/SavedItemPane.jsx index dbfd0ba..6ab9386 100644 --- a/webmaker/src/components/SavedItemPane.jsx +++ b/webmaker/src/components/SavedItemPane.jsx @@ -225,7 +225,7 @@ export default class SavedItemPane extends Component {