Skip to content

Commit b5493ee

Browse files
committed
fix: Fix package.json versions of local lerna versioned deps. Add example of local JS build using Bolt Build Tools.
1 parent 55b4538 commit b5493ee

File tree

13 files changed

+14036
-399
lines changed

13 files changed

+14036
-399
lines changed

build-tools/gulp-tasks/build-webpack/webpack.config.js

Lines changed: 26 additions & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -29,133 +29,67 @@ const sassDataExportPath = `${process.cwd()}/dist`;
2929
const defaultConfig = {
3030
// entry: './src/index.js',
3131
entry: {
32-
'critical-fonts': './src/_patterns/02-components/bolt-critical-fonts/src/critical-fonts',
33-
34-
// './src/components/bolt-icon/dist/icon': [
35-
// // './src/scripts/native-shim.js', //Wrapper for custom-elements-es5-adapter.js so this doesn't break in other browsers like IE11
36-
// // './node_modules/@webcomponents/webcomponentsjs/webcomponents-lite.js',
37-
// // './node_modules/@webcomponents/webcomponentsjs/webcomponents-sd-ce.js',
38-
// './src/components/bolt-icon/src/icon'
39-
// ],
40-
// './dist/scripts/bolt-icon': [
41-
// './node_modules/@webcomponents/webcomponentsjs/custom-elements-es5-adapter.js',
42-
// './node_modules/@webcomponents/webcomponentsjs/webcomponents-lite.js',
43-
// './src/components/bolt-icon/src/icon'
44-
// ],
45-
46-
'bolt-app': [
47-
// './src/scripts/native-shim.js', //Wrapper for custom-elements-es5-adapter.js so this doesn't break in other browsers like IE11
48-
// './node_modules/@webcomponents/webcomponentsjs/webcomponents-lite.js',
49-
// './node_modules/@webcomponents/webcomponentsjs/webcomponents-sd-ce.js',
50-
'./src/scripts/bolt-app'
51-
],
52-
'bolt-critical-path': './src/scripts/bolt-critical-path',
32+
'critical-fonts':
33+
'./src/_patterns/02-components/bolt-critical-fonts/src/critical-fonts',
34+
'bolt-app': './src/scripts/bolt-app',
35+
'bolt-critical-path': './src/scripts/bolt-critical-path'
5336
},
5437
output: {
5538
path: `${process.cwd()}/dist/scripts/`,
5639
filename: '[name].min.js',
5740
publicPath: `/scripts/`,
58-
chunkFilename: `[id].chunk.js`
41+
chunkFilename: `[name]-chunk.min.js`,
42+
libraryTarget: 'umd'
5943
},
6044
devtool: 'cheap-module-source-map',
6145
// devtool: 'cheap-source-map',
6246
resolve: {
6347
// Help webpack find local Bolt code in the src folder
6448
mainFields: ['module:dev', 'browser', 'module', 'main'],
6549
alias: {
66-
styles: path.resolve(__dirname, 'src/styles'),
50+
styles: path.resolve(__dirname, 'src/styles')
6751
},
6852
extensions: ['.js', '.jsx', '.json', '.svg', '.scss']
6953
},
7054

71-
7255
module: {
7356
rules: [
74-
// {
75-
// test: /node_modules\/skatejs\/**\/*\.js?$/,
76-
// // include: /skatejs/,
77-
// // exclude: /!node_modules\/skatejs/,
78-
// use: ['awesome-typescript-loader']
79-
// },webpack:///
8057
{
8158
test: /\.js$/,
82-
// exclude: /\.es6.js$/,
8359
exclude: /(node_modules\/@skatejs\/renderer-lit-html\/dist\/node\/index\.js|native-shim\.js|node_modules\/\@webcomponents\/webcomponentsjs\/custom-elements-es5-adapter\.js|\@webcomponents\/webcomponentsjs\/custom-elements-es5-adapter\.js|custom-elements-es5-adapter\.js|bower_components)/,
8460
use: {
8561
loader: 'babel-loader',
8662
options: {
8763
babelrc: false,
8864
plugins: [
89-
90-
// [
91-
// 'jsx-pragmatic',
92-
// {
93-
// module: 'preact',
94-
// export: 'h',
95-
// import: 'h'
96-
// }
97-
// ],
9865
[
9966
'transform-react-jsx',
10067
{
10168
pragma: 'h'
10269
}
10370
],
104-
"transform-decorators-legacy"
105-
// ['module-resolver',
106-
// {
107-
// root: [
108-
// './src'
109-
// ],
110-
// alias: {
111-
// h: 'preact'
112-
// }
113-
// }
114-
// ],
115-
// 'transform-class-properties',
116-
// 'transform-custom-element-classes',
117-
// 'transform-es2015-classes',
118-
// 'transform-object-assign',
119-
// 'transform-object-rest-spread',
120-
// 'inline-react-svg'
71+
'transform-decorators-legacy'
12172
],
12273

12374
presets: [
12475
[
125-
"env",
76+
'env',
12677
{
12778
targets: {
12879
// browsers: [
12980
// 'last 3 versions',
13081
// 'not ie < 9'
13182
// ]
13283
},
133-
"modules": false
84+
modules: false
13485
}
13586
],
136-
"flow",
137-
"react",
138-
"es2015",
139-
"es2016",
140-
"es2017",
141-
"stage-0",
142-
// ['env', {
143-
// targets: {
144-
// browsers: [
145-
// 'last 3 versions',
146-
// 'not ie < 9'
147-
// ]
148-
// },
149-
// debug: false
150-
// }],
151-
// "react",
152-
// "es2016",
153-
// "es2017",
154-
// // "flow",
155-
// "react",
156-
// "stage-0"
157-
// 'stage-0'
158-
// "flow",
87+
'flow',
88+
'react',
89+
'es2015',
90+
'es2016',
91+
'es2017',
92+
'stage-0'
15993
]
16094
}
16195
}
@@ -165,21 +99,13 @@ const defaultConfig = {
16599
exclude: /\.scoped.scss$/,
166100
use: [
167101
{
168-
loader: 'css-loader',
169-
// options: {
170-
// sourceMap: true,
171-
// modules: true,
172-
// importLoaders: true,
173-
// localIdentName: '[name]__[local]___[hash:base64:5]'
174-
// }
102+
loader: 'css-loader'
175103
},
176104
{
177105
loader: 'postcss-loader',
178106
options: {
179-
plugins: function () {
180-
return [
181-
require('autoprefixer')
182-
];
107+
plugins: function() {
108+
return [require('autoprefixer')];
183109
}
184110
}
185111
},
@@ -220,10 +146,8 @@ const defaultConfig = {
220146
{
221147
loader: 'postcss-loader',
222148
options: {
223-
plugins: function () {
224-
return [
225-
require('autoprefixer')
226-
];
149+
plugins: function() {
150+
return [require('autoprefixer')];
227151
}
228152
}
229153
},
@@ -263,20 +187,11 @@ const defaultConfig = {
263187
maxEntrypointSize: 1500000
264188
},
265189
plugins: [
266-
new webpack.optimize.CommonsChunkPlugin({
267-
// name: "app",
268-
// or
269-
// names: ["app", "subPageA"],
270-
// the name or list of names must match the name or names
271-
// of the entry points that create the async chunks
190+
new CommonsChunkPlugin({
191+
deepChildren: true,
272192
children: true,
273-
// (use all children of the chunk)
274-
275-
async: true,
276-
// (create an async commons chunk)
277-
278-
minChunks: 2,
279-
// (3 children must share the module before it's separated)
193+
minChunks: Infinity,
194+
async: true
280195
}),
281196
new webpack.IgnorePlugin(/vertx/), // needed to ignore vertx dependency in webcomponentsjs-lite
282197
new ExtractTextPlugin({
@@ -313,7 +228,7 @@ const defaultConfig = {
313228
};
314229

315230

316-
231+
317232

318233

319234

composer.lock

Lines changed: 17 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)