Skip to content
This repository has been archived by the owner on Dec 12, 2020. It is now read-only.

Commit

Permalink
fix: adding safety checks to options
Browse files Browse the repository at this point in the history
  • Loading branch information
JessicaSachs committed Apr 27, 2020
1 parent 3de2ee8 commit 029de14
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions preprocessor/webpack.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const fw = require('find-webpack')
const webpackOptions = fw.getWebpackOptions()

// Preventing chunks because we don't serve static assets
function preventChunking (options) {
function preventChunking (options = {}) {
if (options && options.optimization && options.optimization.splitChunks) {
delete options.optimization.splitChunks
}
Expand All @@ -22,7 +22,7 @@ function preventChunking (options) {
}

// Base 64 all the things because we don't serve static assets
function inlineUrlLoadedAssets (options) {
function inlineUrlLoadedAssets (options = {}) {
const isUrlLoader = use => use.loader.indexOf('url-loader') > -1
const mergeUrlLoaderOptions = use => {
if (isUrlLoader(use)) {
Expand All @@ -43,10 +43,11 @@ function inlineUrlLoadedAssets (options) {
return options
}

function compileTemplate(options = {}) {
function compileTemplate (options = {}) {
options.resolve = options.resolve || {}
options.resolve.alias = options.resolve.alias || {}
options.resolve.alias['vue$'] = options.resolve.alias['vue$'] || 'vue/dist/vue.esm.js'
options.resolve.alias['vue$'] =
options.resolve.alias['vue$'] || 'vue/dist/vue.esm.js'
}
inlineUrlLoadedAssets(webpackOptions)
preventChunking(webpackOptions)
Expand Down

0 comments on commit 029de14

Please sign in to comment.