Skip to content

Commit

Permalink
First init. Working fine with 'useBuiltIns: false' and '@babel/polyfi…
Browse files Browse the repository at this point in the history
…ll' added to entry
  • Loading branch information
StabbarN committed Apr 5, 2018
0 parents commit 3821b29
Show file tree
Hide file tree
Showing 6 changed files with 4,148 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
*.sublime-*
node_modules
build
yarn-error.log

35 changes: 35 additions & 0 deletions app/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// import 'babel-polyfill'
// import '@babel/polyfill'

import 'indexeddbshim'
window.shimIndexedDB.__useShim()
import Dexie from 'dexie'

(function() {
const shimIndexedDB = window.shimIndexedDB
const shimIDBKeyRange = window.IDBKeyRange

const db = new Dexie('testDBshim', {
autoOpen: false,
indexedDB: shimIndexedDB,
IDBKeyRange: shimIDBKeyRange,
})
db.version(1).stores({
logs: '++id',
})
console.log('Will open DB')
// alert('Will open DB')
db.open().then(() => {
console.log('Did open DB')
// alert('Did open DB')

const testLog = {
message: 'first log'
}
return db['logs'].add(testLog)
}).then(() => {
alert('Did add first log')
}).catch((err) => {
alert('Caught an error:' + err)
})
})();
13 changes: 13 additions & 0 deletions app/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!doctype html>

<html>
<head>
<meta charset="utf-8">
<title>Shim test</title>
</head>

<body>
<p>Init shim</p>
<script src="/build/bundle.js"></script>
</body>
</html>
18 changes: 18 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name": "punch_clock_main",
"version": "1.0.0",
"main": "app.js",
"author": "",
"license": "MIT",
"scripts": {},
"dependencies": {
"@babel/core": "^7.0.0-beta.44",
"@babel/polyfill": "^7.0.0-beta.44",
"@babel/preset-env": "^7.0.0-beta.44",
"babel-loader": "^8.0.0-beta.2",
"dexie": "^2.0.2",
"indexeddbshim": "^3.5.1",
"serve": "^6.5.3",
"webpack": "^3.10.0"
}
}
42 changes: 42 additions & 0 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
var path = require( 'path' ) // eslint-disable-line no-undef

const config = {
entry: [
// 'babel-polyfill',
'@babel/polyfill',
'./app/app.js'
],
output: {
path: path.resolve(__dirname, "build"),
publicPath: "/assets/",
filename: "bundle.js"
},
resolve: {
extensions: ['.js']
},
module: {
rules: [
{
test: /\.(js)?$/,
loader: 'babel-loader',
options: {
babelrc: false,
presets: [
['@babel/preset-env', {
useBuiltIns: false,
targets: {
browsers: [
'iOS >= 9',
],
},
}],
],
plugins: [
// '@babel/plugin-transform-sticky-regex',
],
},
}
],
},
}
module.exports = config
Loading

0 comments on commit 3821b29

Please sign in to comment.