Skip to content

Commit

Permalink
ゼロコンフィグのサンプルを追加
Browse files Browse the repository at this point in the history
  • Loading branch information
ics-ikeda committed Feb 27, 2018
1 parent e39d0a8 commit 892e803
Show file tree
Hide file tree
Showing 11 changed files with 168 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tutorial-babel-zero_config/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"presets": [
["env", {"modules": false}]
]
}
1 change: 1 addition & 0 deletions tutorial-babel-zero_config/dist/main.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions tutorial-babel-zero_config/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"scripts": {
"build": "webpack --mode production --module-bind 'js=babel-loader'"
},
"devDependencies": {
"babel-core": "^6.26.0",
"babel-loader": "^7.1.3",
"babel-preset-env": "^1.6.1",
"webpack": "^4.0.1",
"webpack-cli": "^2.0.9"
},
"private": true
}
6 changes: 6 additions & 0 deletions tutorial-babel-zero_config/src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import {hello} from './sub';

const message = 'Hello World';

// sub.jsに定義されたJavaScriptを実行する。
hello(message);
5 changes: 5 additions & 0 deletions tutorial-babel-zero_config/src/sub.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// module.exportを使ってhello関数を定義する。
export const hello = (message) => {
document.body.innerHTML = (`${message}`);
console.log(`${message}を出力しました`);
};
1 change: 1 addition & 0 deletions tutorial-typescript-zero_config/dist/main.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions tutorial-typescript-zero_config/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"scripts": {
"build": "webpack --mode production --module-bind 'ts=ts-loader' --resolve-extensions .ts"
},
"devDependencies": {
"ts-loader": "^4.0.0",
"typescript": "^2.7.2",
"webpack": "^4.0.1",
"webpack-cli": "^2.0.9"
},
"private": true
}
6 changes: 6 additions & 0 deletions tutorial-typescript-zero_config/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import {hello} from './sub';

const message: string = 'Hello World';

// sub.jsに定義されたJavaScriptを実行する。
hello(message);
8 changes: 8 additions & 0 deletions tutorial-typescript-zero_config/src/sub.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// module.exportを使ってhello関数を定義する。
export const hello = (message: string): void => {
log(message);
};

function log(message: string): void {
console.log(`${message}を出力しました`);
}
13 changes: 13 additions & 0 deletions tutorial-typescript-zero_config/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"compilerOptions": {
"sourceMap": true,
// TSはECMAScript 5に変換
"target": "es5",
// TSのモジュールはES Modulesとして出力
"module": "es2015",
"lib": [
"dom",
"es2017"
]
}
}
98 changes: 98 additions & 0 deletions tutorial-webpack-dev-server/dist/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, {
/******/ configurable: false,
/******/ enumerable: true,
/******/ get: getter
/******/ });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = "./src/index.js");
/******/ })
/************************************************************************/
/******/ ({

/***/ "./src/index.js":
/*!**********************!*\
!*** ./src/index.js ***!
\**********************/
/*! no exports provided */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _sub__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./sub */ \"./src/sub.js\");\n\n\nObject(_sub__WEBPACK_IMPORTED_MODULE_0__[\"hello\"])(\"こんにちは、世界 !\");\n\n\n//# sourceURL=webpack:///./src/index.js?");

/***/ }),

/***/ "./src/sub.js":
/*!********************!*\
!*** ./src/sub.js ***!
\********************/
/*! exports provided: hello */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"hello\", function() { return hello; });\n// hello関数を定義する。\nfunction hello(message) {\n document.body.innerHTML = message;\n console.log(message);\n}\n\n\n//# sourceURL=webpack:///./src/sub.js?");

/***/ })

/******/ });

0 comments on commit 892e803

Please sign in to comment.