Skip to content

Commit

Permalink
chore(sandbox): Organize and set some globals for convenience
Browse files Browse the repository at this point in the history
  • Loading branch information
zenflow committed Mar 5, 2018
1 parent 2d08869 commit a52214b
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 12 deletions.
11 changes: 0 additions & 11 deletions sandbox/app.js

This file was deleted.

6 changes: 6 additions & 0 deletions sandbox/example.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { swalWithReactContent } from './swalWithReactContent'
import { StatefulElement } from './StatefulElement'

export const example = async () => {
await swalWithReactContent(<StatefulElement />)
}
5 changes: 5 additions & 0 deletions sandbox/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { setGlobals } from './setGlobals'
import { example } from './example'

setGlobals()
example().catch(console.error)
11 changes: 11 additions & 0 deletions sandbox/setGlobals.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import swal from 'sweetalert2'
import sweetalert2ReactContent from '../src/main'
import { swalWithReactContent } from './swalWithReactContent'

export const setGlobals = () => {
Object.assign(global, {
swal,
sweetalert2ReactContent,
swalWithReactContent,
})
}
4 changes: 4 additions & 0 deletions sandbox/swalWithReactContent.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import swal from 'sweetalert2'
import sweetalert2ReactContent from '../src/main'

export const swalWithReactContent = sweetalert2ReactContent(swal)
2 changes: 1 addition & 1 deletion webpack.config.sandbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const HtmlWebpackPlugin = require('html-webpack-plugin')
module.exports = {
mode: 'development',
devtool: 'cheap-module-source-map',
entry: ['babel-polyfill', require.resolve('./sandbox/app')],
entry: ['babel-polyfill', require.resolve('./sandbox/main')],
output: {
pathinfo: true, // Add /* filename */ comments to generated require()s in the output.
filename: 'bundle.js', // This does not produce a real file. It's just a virtual path.
Expand Down

0 comments on commit a52214b

Please sign in to comment.