Skip to content

Commit

Permalink
midway through upgrade to webpack
Browse files Browse the repository at this point in the history
  • Loading branch information
wheresrhys committed Jan 21, 2018
1 parent efeac76 commit 8af8658
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 16 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
.PHONY: test

build-sw:
./node_modules/.bin/browserify test/fixtures/sw.js > test/fixtures/built-sw.js
./node_modules/.bin/webpack --entry ./test/fixtures/sw.js --output-filename ./test/fixtures/built-sw.js

test-dev: build-sw
./node_modules/karma/bin/karma start
./node_modules/karma/bin/karma start --browsers=Chrome

test-chrome: build-sw
./node_modules/karma/bin/karma start --single-run --browsers=Chrome
Expand Down
36 changes: 26 additions & 10 deletions karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module.exports = function(karma) {

var configuration = {

frameworks: [ 'mocha', 'chai', 'browserify'],
frameworks: [ 'mocha', 'chai'],
files: [
'test/client.js',
'test/sw.js',
Expand All @@ -14,16 +14,32 @@ module.exports = function(karma) {
'/__sw.js': '/base/test/fixtures/built-sw.js'
},
preprocessors: {
'test/*.js': ['browserify']
'test/**/*.js': ['webpack']
},
browserify: {
debug: true,
plugins: ['transform-runtime'],
transform: [
['babelify', {
'presets': ['env']
}]
]
webpack: {
devtool: 'source-map',
module: {
rules: [
//babel
{
test: /\.js$/,
loader: 'babel-loader',
query: {
babelrc: false, // ignore any .babelrc in project & dependencies
cacheDirectory: true,
plugins: [
// ensures a module reqired multiple times is only transpiled once and
// is shared by all that use it rather than transpiling it each time
[require.resolve('babel-plugin-transform-runtime'),{
helpers: true,
polyfill: false,
}],
],
presets: [require.resolve('babel-preset-env')]
}
}
]
}
}
};

Expand Down
7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,25 +35,24 @@
"devDependencies": {
"babel": "^6.0.15",
"babel-cli": "^6.1.2",
"babel-loader": "^7.1.2",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-polyfill": "^6.26.0",
"babel-preset-env": "^1.6.1",
"babelify": "^7.3.0",
"bluebird": "^3.4.6",
"browserify": "^13.1.0",
"chai": "^4.1.2",
"coveralls": "^2.11.16",
"eslint": "^4.14.0",
"istanbul": "^1.1.0-alpha.1",
"karma": "^2.0.0",
"karma-browserify": "^5.1.3",
"karma-chai": "^0.1.0",
"karma-chrome-launcher": "^2.2.0",
"karma-mocha": "^1.3.0",
"karma-webpack": "^2.0.9",
"mocha": "^4.0.1",
"node-fetch": "^2.0.0-alpha.9",
"sinon": "^4.1.3",
"sinon-chai": "^2.14.0",
"watchify": "^3.9.0"
"webpack": "^3.10.0"
}
}

0 comments on commit 8af8658

Please sign in to comment.