diff options
author | eric <thul.eric@gmail.com> | 2016-01-19 08:41:51 -0500 |
---|---|---|
committer | eric <thul.eric@gmail.com> | 2016-01-19 08:41:51 -0500 |
commit | 2ecf85616a2b56ec9ff675c8f45b7dcf5607fc86 (patch) | |
tree | f8ad39dc0d21ae4add8f2a3877edf24294d2910f /example | |
parent | 94cc1cdd03b9c2115813a698b1e4337bce894321 (diff) | |
parent | c01553307e6fcd0abada0b9b2f9ca8d6bb82b863 (diff) | |
download | purs-loader-2ecf85616a2b56ec9ff675c8f45b7dcf5607fc86.tar.gz purs-loader-2ecf85616a2b56ec9ff675c8f45b7dcf5607fc86.tar.zst purs-loader-2ecf85616a2b56ec9ff675c8f45b7dcf5607fc86.zip |
Merge pull request #34 from ethul/topic/psc-webpack-plugin
Topic/psc webpack plugin
Diffstat (limited to 'example')
-rw-r--r-- | example/package.json | 7 | ||||
-rw-r--r-- | example/src/Bar.purs | 3 | ||||
-rw-r--r-- | example/src/Foo.purs | 6 | ||||
-rw-r--r-- | example/src/Test.purs | 6 | ||||
-rw-r--r-- | example/src/entry.js | 10 | ||||
-rw-r--r-- | example/src/jam.js | 5 | ||||
-rw-r--r-- | example/webpack.config.js | 18 |
7 files changed, 32 insertions, 23 deletions
diff --git a/example/package.json b/example/package.json index d1319b1..e256de8 100644 --- a/example/package.json +++ b/example/package.json | |||
@@ -3,15 +3,16 @@ | |||
3 | "version": "0.0.0", | 3 | "version": "0.0.0", |
4 | "private": true, | 4 | "private": true, |
5 | "scripts": { | 5 | "scripts": { |
6 | "build": "mkdir -p output && ./node_modules/.bin/webpack --progress --colors", | 6 | "build": "webpack --progress --colors --bail", |
7 | "build:watch": "mkdir -p output && ./node_modules/.bin/webpack --progress --colors --watch", | 7 | "build:watch": "webpack --progress --colors --watch", |
8 | "run": "node bundle.js", | 8 | "run": "node bundle.js", |
9 | "clean": "rm -rf bower_components && rm -rf bundle.js && rm -rf node_modules && rm -rf output" | 9 | "clean": "rm -rf bower_components && rm -rf bundle.js && rm -rf node_modules && rm -rf output" |
10 | }, | 10 | }, |
11 | "license": "MIT", | 11 | "license": "MIT", |
12 | "devDependencies": { | 12 | "devDependencies": { |
13 | "node-libs-browser": "^0.5.2", | 13 | "node-libs-browser": "^0.5.2", |
14 | "purescript-webpack-plugin": "^0.1.1", | ||
14 | "purs-loader": "file:../", | 15 | "purs-loader": "file:../", |
15 | "webpack": "^1.10.1" | 16 | "webpack": "^1.12.9" |
16 | } | 17 | } |
17 | } | 18 | } |
diff --git a/example/src/Bar.purs b/example/src/Bar.purs new file mode 100644 index 0000000..a37171f --- /dev/null +++ b/example/src/Bar.purs | |||
@@ -0,0 +1,3 @@ | |||
1 | module Bar where | ||
2 | |||
3 | test = "b" | ||
diff --git a/example/src/Foo.purs b/example/src/Foo.purs index b234e0d..97b7cec 100644 --- a/example/src/Foo.purs +++ b/example/src/Foo.purs | |||
@@ -1,9 +1,9 @@ | |||
1 | module Foo (foo) where | 1 | module Foo where |
2 | 2 | ||
3 | import Prelude | 3 | import Prelude |
4 | 4 | ||
5 | import qualified Foo.Bar as B | 5 | import qualified Foo.Bar as B |
6 | 6 | ||
7 | foo = "b" | 7 | foo = "A" |
8 | 8 | ||
9 | foo' = "c" | 9 | bar = "B" |
diff --git a/example/src/Test.purs b/example/src/Test.purs index 133a192..3a92681 100644 --- a/example/src/Test.purs +++ b/example/src/Test.purs | |||
@@ -1,7 +1,7 @@ | |||
1 | module Test (test, testing) where | 1 | module Test (testing) where |
2 | 2 | ||
3 | import Prelude | 3 | bar = "c" |
4 | 4 | ||
5 | test = "a" | 5 | goo = "a" |
6 | 6 | ||
7 | foreign import testing :: String | 7 | foreign import testing :: String |
diff --git a/example/src/entry.js b/example/src/entry.js index cde8507..a1e2a99 100644 --- a/example/src/entry.js +++ b/example/src/entry.js | |||
@@ -1,9 +1,11 @@ | |||
1 | var Prelude = require('Prelude'); | 1 | var Prelude = require('purescript-prelude/src/Prelude'); |
2 | 2 | ||
3 | var test = require('./Test.purs'); | 3 | var test = require('./Test'); |
4 | 4 | ||
5 | var foo = require('./Foo.purs'); | 5 | var foo = require('./Foo.purs'); |
6 | 6 | ||
7 | var baz = require('./Foo/Baz.purs'); | 7 | var baz = require('./Foo/Baz'); |
8 | 8 | ||
9 | console.log(Prelude, test, foo, baz); | 9 | var jam = require('./jam'); |
10 | |||
11 | console.log(Prelude, test, foo, baz, jam); | ||
diff --git a/example/src/jam.js b/example/src/jam.js new file mode 100644 index 0000000..8889a69 --- /dev/null +++ b/example/src/jam.js | |||
@@ -0,0 +1,5 @@ | |||
1 | var x = 'a'; | ||
2 | |||
3 | var abcde = require('./Bar'); | ||
4 | |||
5 | module.exports = abcde; | ||
diff --git a/example/webpack.config.js b/example/webpack.config.js index f1456d5..602de84 100644 --- a/example/webpack.config.js +++ b/example/webpack.config.js | |||
@@ -1,14 +1,14 @@ | |||
1 | var path = require('path'); | 1 | 'use strict'; |
2 | 2 | ||
3 | var srcs = ['src[]=bower_components/purescript-*/src/**/*.purs', 'src[]=src/**/*.purs']; | 3 | var PurescriptWebpackPlugin = require('purescript-webpack-plugin'); |
4 | 4 | ||
5 | var ffis = ['ffi[]=bower_components/purescript-*/src/**/*.js', 'ffi[]=src/**/*FFI.js']; | 5 | var src = ['bower_components/purescript-*/src/**/*.purs', 'src/**/*.purs']; |
6 | 6 | ||
7 | var output = 'output'; | 7 | var ffi = ['bower_components/purescript-*/src/**/*.js', 'src/**/*FFI.js']; |
8 | 8 | ||
9 | var modulesDirectories = [ | 9 | var modulesDirectories = [ |
10 | 'node_modules', | 10 | 'node_modules', |
11 | 'bower_components/purescript-prelude/src' | 11 | 'bower_components' |
12 | ]; | 12 | ]; |
13 | 13 | ||
14 | var config | 14 | var config |
@@ -18,12 +18,10 @@ var config | |||
18 | , filename: 'bundle.js' | 18 | , filename: 'bundle.js' |
19 | } | 19 | } |
20 | , module: { loaders: [ { test: /\.purs$/ | 20 | , module: { loaders: [ { test: /\.purs$/ |
21 | , loader: 'purs-loader?output=' + output + '&' + srcs.concat(ffis).join('&') | 21 | , loader: 'purs-loader' |
22 | } ] } | 22 | } ] } |
23 | , resolve: { modulesDirectories: modulesDirectories | 23 | , resolve: { modulesDirectories: modulesDirectories, extensions: [ '', '.js', '.purs'] } |
24 | , extensions: ['', '.js'] | 24 | , plugins: [ new PurescriptWebpackPlugin({src: src, ffi: ffi}) ] |
25 | } | ||
26 | , resolveLoader: { root: path.join(__dirname, 'node_modules') } | ||
27 | } | 25 | } |
28 | ; | 26 | ; |
29 | 27 | ||