Skip to content

Commit ef7d53b

Browse files
committed
Fix remaining issues with webpack config
1 parent 93a64bc commit ef7d53b

File tree

6 files changed

+52
-34
lines changed

6 files changed

+52
-34
lines changed

examples/app/app.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@
22

33
var app = angular.module('makeithappen', [
44
'ngRoute',
5-
'jsonforms'
65
]);
76

8-
angular.forEach(['jsonforms-bootstrap'], function(dep) {
9-
app.requires.push(dep);
10-
});
11-
7+
try {
8+
// check whether jsonforms-bootstrap is available
9+
angular.module('jsonforms-bootstrap')
10+
app.requires.push('jsonforms-bootstrap');
11+
} catch(ignored) {
12+
app.requires.push('jsonforms');
13+
}

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
"license": "MIT",
99
"main": "/",
1010
"scripts": {
11-
"dev": "webpack --config webpack/webpack.dev.js; webpack-dev-server --config webpack/webpack.dev.js --NODE_ENV=dev --inline",
12-
"dev-bootstrap": "webpack --config webpack/webpack.dev-bootstrap.js; webpack-dev-server --config webpack/webpack.dev-bootstrap.js --NODE_ENV=dev --inline",
11+
"dev": "webpack --config webpack/webpack.dev.js && webpack-dev-server --config webpack/webpack.dev.js --NODE_ENV=dev --inline",
12+
"dev-bootstrap": "webpack --config webpack/webpack.dev-bootstrap.js && webpack-dev-server --config webpack/webpack.dev-bootstrap.js --NODE_ENV=dev --inline",
1313
"test": "karma start --NODE_ENV=test",
1414
"build": "webpack --config webpack/webpack.build.js --NODE_ENV=production --display-error-details",
1515
"build-bootstrap": "webpack --config webpack/webpack.build-bootstrap.js --NODE_ENV=production --display-error-details",

webpack/webpack.build-bootstrap.js

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,21 @@ var webpack = require('webpack');
33
var CopyWebpackPlugin = require('copy-webpack-plugin');
44

55
module.exports = {
6-
entry: [
7-
"bootstrap-webpack!./bootstrap.config.js",
8-
'./src/bootstrap/jsonforms_bootstrap.ts'
9-
],
6+
devtool: 'source-map',
7+
entry: {
8+
'dist/jsonforms': './src/bootstrap/jsonforms_bootstrap.ts',
9+
'examples/assets/jsonforms': './src/bootstrap/jsonforms_bootstrap.ts'
10+
},
1011
output: {
11-
filename: 'jsonforms-bootstrap.js',
12-
path: 'dist'
12+
filename: '[name].js',
13+
path: './'
14+
},
15+
resolve: {
16+
root: __dirname,
17+
extensions: ['', '.ts', '.js', '.json']
18+
},
19+
resolveLoader: {
20+
modulesDirectories: ["node_modules"]
1321
},
1422
plugins: [
1523
new webpack.optimize.UglifyJsPlugin(
@@ -26,17 +34,16 @@ module.exports = {
2634
'window.jquery': 'jquery'
2735
}),
2836
new CopyWebpackPlugin([
29-
{ from: 'src/bootstrap/jsonforms-bootstrap.css' }
37+
{
38+
from: 'src/bootstrap/jsonforms-bootstrap.css',
39+
to: 'dist/jsonforms.css'
40+
},
41+
{
42+
from: 'src/bootstrap/jsonforms-bootstrap.css',
43+
to: 'examples/assets/jsonforms.css'
44+
},
3045
])
3146
],
32-
devtool: 'source-map',
33-
resolve: {
34-
root: __dirname,
35-
extensions: ['', '.ts', '.js', '.json']
36-
},
37-
resolveLoader: {
38-
modulesDirectories: ["node_modules"]
39-
},
4047
module: {
4148
preLoaders: [
4249
{

webpack/webpack.build.js

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@ var CopyWebpackPlugin = require('copy-webpack-plugin');
44

55
module.exports = {
66
devtool: 'source-map',
7-
entry: [
8-
'./src/index.ts'
9-
],
7+
entry: {
8+
'dist/jsonforms': './src/index.ts',
9+
'examples/assets/jsonforms': './src/index.ts'
10+
},
1011
output: {
11-
filename: 'jsonforms.js',
12-
path: 'dist'
12+
filename: '[name].js',
13+
path: './'
1314
},
1415
plugins: [
1516
new webpack.optimize.UglifyJsPlugin(
@@ -26,7 +27,14 @@ module.exports = {
2627
'window.jquery': 'jquery'
2728
}),
2829
new CopyWebpackPlugin([
29-
{ from: 'src/jsonforms.css' }
30+
{
31+
from: 'src/jsonforms.css',
32+
to: 'dist/jsonforms.css'
33+
},
34+
{
35+
from: 'src/jsonforms.css',
36+
to: 'examples/assets/jsonforms.css'
37+
},
3038
])
3139
],
3240
resolve: {

webpack/webpack.dev-bootstrap.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ module.exports = {
1111
],
1212
output: {
1313
filename: 'jsonforms.js',
14-
path: 'dist',
1514
publicPath: '/assets/'
1615
},
1716
resolve: {
@@ -36,11 +35,11 @@ module.exports = {
3635
new CopyWebpackPlugin([
3736
{
3837
from: 'src/bootstrap/jsonforms-bootstrap.css',
39-
to: 'jsonforms.css'
38+
to: 'examples/assets/jsonforms.css'
4039
}
4140
])
4241
],
4342
module:{
4443
loaders: loaders
4544
}
46-
};
45+
};

webpack/webpack.dev.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ module.exports = {
1111
],
1212
output: {
1313
filename: 'jsonforms.js',
14-
path: 'dist',
1514
publicPath: '/assets/'
1615
},
1716
resolve: {
@@ -34,10 +33,13 @@ module.exports = {
3433
'window.jquery': 'jquery'
3534
}),
3635
new CopyWebpackPlugin([
37-
{ from: 'src/jsonforms.css' }
36+
{
37+
from: 'src/jsonforms.css',
38+
to: 'examples/assets/jsonforms.css'
39+
}
3840
])
3941
],
4042
module:{
4143
loaders: loaders
4244
}
43-
};
45+
};

0 commit comments

Comments
 (0)