Skip to content

Commit c706314

Browse files
committed
Initial commit with dynamic import
0 parents commit c706314

File tree

10 files changed

+2943
-0
lines changed

10 files changed

+2943
-0
lines changed

.babelrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"presets": ["es2016", "flow"],
3+
"plugins": ["syntax-dynamic-import"]
4+
}

.flowconfig

Whitespace-only changes.

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
node_modules
2+
build/
3+
yarn-error.log
4+
.*.sw?

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# node-js-boilerplate
2+
3+
A super-simple Node starter project with Jest, Flow, Babel, and Webpack.
4+
5+
That's it!
6+
7+
* `npm run start` Compile src/index.js to build/bundle.js and run it.
8+
* `npm run watch` Start watching src/index.js and compile it on change.
9+
* `npm run test` Run Jest tests.
10+
* `npm run flow` Run Flow checks.

package.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"name": "js-app",
3+
"version": "0.0.1",
4+
"description": "",
5+
"main": "src/index.js",
6+
"scripts": {
7+
"start": "webpack && node ./build/bundle",
8+
"watch": "webpack --watch",
9+
"test": "jest",
10+
"flow": "flow"
11+
},
12+
"author": "",
13+
"license": "MIT",
14+
"devDependencies": {
15+
"babel-core": "^6.25.0",
16+
"babel-loader": "^7.0.0",
17+
"babel-plugin-syntax-dynamic-import": "^6.18.0",
18+
"babel-preset-es2016": "^6.24.1",
19+
"babel-preset-flow": "^6.23.0",
20+
"flow-bin": "^0.48.0",
21+
"jest": "^20.0.4",
22+
"webpack": "^2.6.1"
23+
}
24+
}

src/dynamic.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export default function() {
2+
console.log('I am dynamic');
3+
}

src/index.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// @flow
2+
import('./dynamic').then(({ default: dynamic }) => {
3+
console.log('resolved');
4+
console.log(dynamic());
5+
})

src/index.test.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
test('it runs', () => {
2+
expect(1).toEqual(1);
3+
});

webpack.config.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
module.exports = {
2+
entry: "./src/index.js",
3+
target: "node",
4+
output: {
5+
path: __dirname + "/build",
6+
filename: "bundle.js"
7+
},
8+
module: {
9+
loaders: [
10+
{
11+
test: /\.js$/,
12+
exclude: /node_modules/,
13+
loader: 'babel-loader'
14+
}
15+
]
16+
}
17+
};

0 commit comments

Comments
 (0)