This repository has been archived by the owner on Dec 3, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #27 from reasonml-community/use-bsconfig-for-settings
Read bsconfig instead of webpack options
- Loading branch information
Showing
12 changed files
with
174 additions
and
33 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
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
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,10 @@ | ||
{ | ||
"name": "insource-test", | ||
"sources": ["fixtures"], | ||
"package-specs": [ | ||
{ | ||
"module": "es6", | ||
"in-source": true | ||
} | ||
] | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 @@ | ||
let add x y => x + y; |
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 @@ | ||
export const dec = x => x - 1; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,9 @@ | ||
external dec : int -> int = "dec" [@@bs.module "./dec"] | ||
open Add | ||
|
||
let fib n = | ||
let rec aux n a b = | ||
if n = 0 then a | ||
else | ||
aux (dec n) b (add a b) | ||
in aux n 1 1 |
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 @@ | ||
val fib : int -> int |
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,6 @@ | ||
{ | ||
"name": "no-config-test", | ||
"private": true, | ||
"version": "100.0.0", | ||
"license": "MIT" | ||
} |
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,45 @@ | ||
const webpack = require('webpack') | ||
const path = require('path') | ||
const fs = require('fs') | ||
|
||
const output = path.join(__dirname, 'output', 'webpack') | ||
const loader = path.join(__dirname, '..', '..') | ||
|
||
const baseConfig = { | ||
entry: path.join(__dirname, 'fixtures/fib.ml'), | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.(re|ml)$/, | ||
use: { | ||
loader, | ||
options: { | ||
cwd: __dirname | ||
} | ||
} | ||
} | ||
] | ||
}, | ||
resolve: { | ||
extensions: ['.re', '.ml', '.js'] | ||
}, | ||
output: { | ||
path: output, | ||
libraryTarget: 'commonjs2' | ||
} | ||
} | ||
|
||
it('runs', done => { | ||
webpack(baseConfig, err => { | ||
expect(err).toBeNull() | ||
|
||
fs.readdir(output, (err, files) => { | ||
expect(err).toBeNull() | ||
expect(files.length).toBe(1) | ||
const result = require(path.resolve(output, files[0])) | ||
expect(result.fib(12)).toBe(233) | ||
|
||
done() | ||
}) | ||
}) | ||
}) |
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 |
---|---|---|
|
@@ -14,7 +14,6 @@ const baseConfig = { | |
use: { | ||
loader, | ||
options: { | ||
module: 'es6', | ||
cwd: __dirname | ||
} | ||
} | ||
|