Skip to content

Commit

Permalink
fix: use babel-preset target current
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoiver committed Nov 28, 2017
1 parent 6cb086c commit 0b604c4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"env",
{
"targets": {
"node": 4
"node": "current",
}
}
],
Expand Down
10 changes: 7 additions & 3 deletions core/utils/workbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
* @file utils.workbox.js
* @author lavas
*/
import {version} from 'workbox-sw/package.json';
import {basename} from 'path';

export const WORKBOX_PATH = require.resolve('workbox-sw');

/**
* get workbox files
Expand All @@ -11,8 +13,10 @@ import {version} from 'workbox-sw/package.json';
* @return {Array} files .js & .map
*/
export function getWorkboxFiles(isProd) {
let filename = isProd
? basename(WORKBOX_PATH) : basename(WORKBOX_PATH).replace('prod', 'dev');
return [
`workbox-sw.${isProd ? 'prod' : 'dev'}.v${version}.js`,
`workbox-sw.${isProd ? 'prod' : 'dev'}.v${version}.js.map`
filename,
`${filename}.map`
];
}
4 changes: 1 addition & 3 deletions core/webpack.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import WorkboxWebpackPlugin from 'workbox-webpack-plugin';

import {vueLoaders, styleLoaders} from './utils/loader';
import {assetsPath} from './utils/path';
import {getWorkboxFiles} from './utils/workbox';
import {WORKBOX_PATH, getWorkboxFiles} from './utils/workbox';
import {LAVAS_DIRNAME_IN_DIST, SERVER_BUNDLE, ASSETS_DIRNAME_IN_DIST} from './constants';

import fs from 'fs';
Expand Down Expand Up @@ -268,8 +268,6 @@ export default class WebpackConfig {
}];
// Copy workbox.dev|prod.js from node_modules manually.
if (this.isProd && workboxConfig) {
// node_modules/workbox-sw/build/importScripts/workbox-sw.prod.v2.1.2.js
const WORKBOX_PATH = require.resolve('workbox-sw');
copyList = copyList.concat(
getWorkboxFiles(this.isProd)
.map(f => {
Expand Down

0 comments on commit 0b604c4

Please sign in to comment.