Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

webpack5 #44

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
const presets = [
[
"@babel/env",
{
"useBuiltIns": "usage",
"corejs": 3,
"targets": {
"chrome": "58",
"ie": "8"
}
}
]
]
module.exports = { presets }
20 changes: 9 additions & 11 deletions example/common-js-worker.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
var gamma = require('gamma');
var gamma = require('gamma')

module.exports = function () {
self.addEventListener('message',function (ev){
var startNum = parseInt(ev.data); // ev.data=4 from main.js

setInterval(function () {
var r = startNum / Math.random() - 1;
self.postMessage([ startNum, r, gamma(r) ]);
}, 500);
});
};
self.addEventListener('message', function (ev) {
var startNum = parseInt(ev.data) // ev.data=4 from main.js

setInterval(function () {
var r = startNum / Math.random() - 1
self.postMessage([startNum, r, gamma(r)])
}, 500)
})
20 changes: 9 additions & 11 deletions example/es6-worker.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import gamma from 'gamma';
import gamma from 'gamma'

self.addEventListener('message', function (ev) {
var startNum = parseInt(ev.data) // ev.data=4 from main.js
setInterval(function () {
var r = startNum / Math.random() - 1
self.postMessage([startNum, r, gamma(r)])
}, 500)
})

export default function () {
self.addEventListener('message',function (ev){
var startNum = parseInt(ev.data); // ev.data=4 from main.js

setInterval(function () {
var r = startNum / Math.random() - 1;
self.postMessage([ startNum, r, gamma(r) ]);
}, 500);
});
};
17 changes: 3 additions & 14 deletions example/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
var webpack = require('webpack')

module.exports = {
mode: "development",
entry: {
app: ['./example/main.js']
},
Expand All @@ -13,18 +12,8 @@ module.exports = {
{
test: /\.jsx?$/,
exclude: /node_modules/,
use: [
{
loader: 'babel-loader',
options: {
presets: ['es2015']
}
}
]
use: 'babel-loader'
}
]
},
plugins: [
new webpack.NamedModulesPlugin()
]
}
}
Loading