Skip to content

Commit 60616b0

Browse files
author
Aamod Pisat
committed
added package.json while webpack build
1 parent a05375b commit 60616b0

File tree

5 files changed

+41
-19
lines changed

5 files changed

+41
-19
lines changed

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"buildnode": "webpack --config webpack/webpack.node.js",
1616
"buildweb": "webpack -p --config webpack/webpack.web.js",
1717
"buildreactnative": "webpack --config webpack/webpack.react-native.js",
18-
"buildall": "npm run buildnode;npm run buildweb;npm run buildreactnative",
18+
"buildall": "npm run buildnode&npm run buildweb&npm run buildreactnative",
1919
"generate-docs": "node_modules/.bin/jsdoc --configure docs-config.json --verbose"
2020
},
2121
"repository": {
@@ -70,7 +70,8 @@
7070
"webpack": "2.2.1",
7171
"webpack-md5-hash": "0.0.5",
7272
"webpack-merge": "0.17.0",
73-
"babel-runtime": "6.23.0"
73+
"babel-runtime": "6.23.0",
74+
"string-replace-loader": "1.3.0"
7475
},
7576
"dependencies": {
7677
"isomorphic-fetch": "2.2.1",

webpack/webpack.common.js

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1-
var webpack = require('webpack');
2-
var path = require('path');
1+
'use strict';
32

3+
const webpack = require('webpack');
4+
const path = require('path');
5+
6+
const Package = require('./../package.json');
7+
48
module.exports = function (options) {
59
return {
610

@@ -14,17 +18,27 @@ module.exports = function (options) {
1418

1519
module: {
1620
rules: [
17-
{
18-
test: /\.js?$/,
19-
exclude: ['../node_modules'],
20-
use: [{
21+
{
22+
test: /\.js?$/,
23+
exclude: ['../node_modules'],
24+
use: [
25+
{
2126
loader:'babel-loader',
2227
options: {
2328
presets: ['es2015'],
2429
}
25-
}],
30+
},
31+
{
32+
loader:'string-replace-loader',
33+
query: {
34+
search: '{{VERSION}}',
35+
replace: Package.version
36+
}
37+
}
38+
],
2639
}
2740
]
41+
2842
},
2943

3044
plugins: [

webpack/webpack.node.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
var path = require('path');
2-
var webpackMerge = require('webpack-merge');
3-
var commonConfig = require('./webpack.common.js');
1+
'use strict';
2+
const path = require('path');
3+
const webpackMerge = require('webpack-merge');
4+
5+
const commonConfig = require('./webpack.common.js');
46

57
module.exports = function (options) {
68
return webpackMerge(commonConfig(),{

webpack/webpack.react-native.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
var path = require('path');
2-
var webpackMerge = require('webpack-merge');
3-
var commonConfig = require('./webpack.common.js');
1+
'use strict';
2+
3+
const path = require('path');
4+
const webpackMerge = require('webpack-merge');
5+
6+
const commonConfig = require('./webpack.common.js');
47

58
module.exports = function (options) {
69
return webpackMerge(commonConfig(),{
@@ -10,7 +13,6 @@ module.exports = function (options) {
1013
path: path.join(__dirname, "../dist/react-native"),
1114
filename: "contentstack.js"
1215
},
13-
target: "node",
1416
resolve: {
1517
alias:{
1618
runtime: path.resolve( __dirname, '../src/runtime/react-native')

webpack/webpack.web.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
var path = require('path');
2-
var webpackMerge = require('webpack-merge');
3-
var commonConfig = require('./webpack.common.js');
1+
'use strict';
2+
3+
const path = require('path');
4+
const webpackMerge = require('webpack-merge');
5+
6+
const commonConfig = require('./webpack.common.js');
47

58
module.exports = function (options) {
69
return webpackMerge(commonConfig(),{

0 commit comments

Comments
 (0)