-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 9b6f86e
Showing
17 changed files
with
10,236 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"presets": ["@babel/preset-env"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
node_modules | ||
dist | ||
types |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
src |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"printWidth": 100, | ||
"singleQuote": true, | ||
"trailingComma": "es5" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"plugins": [ | ||
"syntax-dynamic-import", | ||
[ | ||
"@babel/plugin-transform-runtime", | ||
{ | ||
"regenerator": true | ||
} | ||
] | ||
], | ||
"presets": [["@babel/preset-env"]] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# 🚀 Welcome to your new awesome project! | ||
|
||
This project has been created using **webpack scaffold**, you can now run | ||
|
||
``` | ||
npm run build | ||
``` | ||
|
||
or | ||
|
||
``` | ||
yarn build | ||
``` | ||
|
||
to bundle your application |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{ | ||
"name": "tosspayments-example", | ||
"version": "1.0.0", | ||
"description": "My webpack project", | ||
"main": "index.js", | ||
"author": "Toss Payments", | ||
"license": "MIT", | ||
"private": true, | ||
"devDependencies": { | ||
"@babel/core": "^7.9.0", | ||
"@babel/plugin-transform-runtime": "^7.9.0", | ||
"@babel/preset-env": "^7.9.0", | ||
"@webpack-cli/init": "0.2.2", | ||
"babel-loader": "^8.1.0", | ||
"babel-plugin-syntax-dynamic-import": "^6.18.0", | ||
"html-webpack-plugin": "^4.0.3", | ||
"terser-webpack-plugin": "^2.3.5", | ||
"webpack": "^4.42.1", | ||
"webpack-cli": "^3.3.11", | ||
"webpack-dev-server": "^3.10.3", | ||
"workbox-webpack-plugin": "^5.1.2" | ||
}, | ||
"scripts": { | ||
"dev": "NODE_ENV=development webpack-dev-server", | ||
"build": "NODE_ENV=production webpack" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
|
||
<head> | ||
<title>TossPayments 예제</title> | ||
</head> | ||
|
||
<body> | ||
<button onclick="startCommonPayment()">인증 결제 (Common)</button> | ||
<button onclick="startDirectPayment()">비인증 결제 (Direct)</button> | ||
</body> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import TossPayments from '../../dist/tosspayments.esm'; | ||
|
||
const tossPayments = TossPayments('test_ck_OEP59LybZ8Bdv6A1JxkV6GYo7pRe'); | ||
|
||
window.startCommonPayment = async () => { | ||
const { result } = await tossPayments.requestPayment({ | ||
amount: 1000, | ||
productName: '토스 티셔츠', | ||
userName: '토스', | ||
}); | ||
|
||
if (result === 'SUCCESS') { | ||
alert('결제에 성공했습니다!'); | ||
} else if (result === 'CANCELED') { | ||
alert('결제를 취소하였습니다.'); | ||
} else if (result === 'FAIL') { | ||
alert('결제에 실패했습니다.'); | ||
} | ||
}; | ||
|
||
window.startDirectPayment = async () => { | ||
const { result } = await tossPayments.requestDirectPayment({ | ||
amount: 1000, | ||
productName: '토스 티셔츠', | ||
userName: '토스', | ||
}); | ||
|
||
if (result === 'SUCCESS') { | ||
alert('결제에 성공했습니다!'); | ||
} else if (result === 'CANCELED') { | ||
alert('결제를 취소하였습니다.'); | ||
} else if (result === 'FAIL') { | ||
alert('결제에 실패했습니다.'); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
const path = require('path'); | ||
const webpack = require('webpack'); | ||
const HtmlWebpackPlugin = require('html-webpack-plugin'); | ||
|
||
/* | ||
* SplitChunksPlugin is enabled by default and replaced | ||
* deprecated CommonsChunkPlugin. It automatically identifies modules which | ||
* should be splitted of chunk by heuristics using module duplication count and | ||
* module category (i. e. node_modules). And splits the chunks… | ||
* | ||
* It is safe to remove "splitChunks" from the generated configuration | ||
* and was added as an educational example. | ||
* | ||
* https://webpack.js.org/plugins/split-chunks-plugin/ | ||
* | ||
*/ | ||
|
||
/* | ||
* We've enabled TerserPlugin for you! This minifies your app | ||
* in order to load faster and run less javascript. | ||
* | ||
* https://github.com/webpack-contrib/terser-webpack-plugin | ||
* | ||
*/ | ||
|
||
const TerserPlugin = require('terser-webpack-plugin'); | ||
|
||
module.exports = { | ||
mode: process.env.NODE_ENV, | ||
plugins: [new webpack.ProgressPlugin(), new HtmlWebpackPlugin({ template: './src/index.html' })], | ||
output: { | ||
path: path.resolve(__dirname, 'dist'), | ||
filename: '[name].[hash].js', | ||
publicPath: '/', | ||
}, | ||
devServer: { | ||
contentBase: path.join(__dirname, 'public'), | ||
port: 3000, | ||
hot: true, | ||
}, | ||
module: { | ||
rules: [ | ||
{ | ||
test: /.(js|jsx)$/, | ||
exclude: /node_modules/, | ||
loader: 'babel-loader', | ||
}, | ||
], | ||
}, | ||
|
||
optimization: { | ||
minimizer: [new TerserPlugin()], | ||
|
||
splitChunks: { | ||
cacheGroups: { | ||
vendors: { | ||
priority: -10, | ||
test: /[\\/]node_modules[\\/]/, | ||
}, | ||
}, | ||
|
||
chunks: 'async', | ||
minChunks: 1, | ||
minSize: 30000, | ||
name: true, | ||
}, | ||
}, | ||
}; |
Oops, something went wrong.