From 325d1f1a326a4ef5eaa070e56665c9b5680f1e36 Mon Sep 17 00:00:00 2001 From: Yukai Huang Date: Fri, 7 Oct 2016 23:05:23 +0800 Subject: Create webpack config --- webpack.config.js | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 webpack.config.js (limited to 'webpack.config.js') diff --git a/webpack.config.js b/webpack.config.js new file mode 100644 index 00000000..01adea94 --- /dev/null +++ b/webpack.config.js @@ -0,0 +1,64 @@ +var webpack = require('webpack'); +var path = require('path'); +var ExtractTextPlugin = require("extract-text-webpack-plugin"); + +module.exports = { + plugins: [ + new webpack.ProvidePlugin({ + '_': 'lodash', + jquery: "jquery", + jQuery: "jquery", + $: "jquery", + "window.jQuery": "jquery", + Visibility: "visibilityjs", + Cookies: "js-cookie", + CodeMirror: "codemirror" + }), + new webpack.DefinePlugin({ + "require.specified": "require.resolve" + }) + ], + + entry: { + app: path.join(__dirname, 'public/js/app.js') + }, + + output: { + path: path.join(__dirname, 'public/build/js'), + filename: '[name].js' + }, + + resolve: { + root: [ + path.resolve(__dirname, 'src'), + path.resolve(__dirname, 'node_modules') + ], + extensions: ["", ".js"], + alias: { + 'jquery-ui': 'jquery-ui/ui/widgets' + } + }, + + module: { + loaders: [{ + test: /\.json$/, + loader: 'json-loader' + }, { + test: /\.css$/, + loader: ExtractTextPlugin.extract({ + fallbackLoader: "style-loader", + loader: "css-loader" + }) + }, { + test: /\.scss$/, + loaders: ['style', 'css', 'sass'] + }, { + test: require.resolve("js-sequence-diagrams"), + loader: "imports?Raphael=raphael" + }] + }, + + node: { + fs: "empty" + } +}; -- cgit v1.2.3 From 963a435ae1e9248b42b4665acf106dcffa549678 Mon Sep 17 00:00:00 2001 From: Yukai Huang Date: Sat, 8 Oct 2016 20:02:30 +0800 Subject: Resolve dependency module requiring * es5 style module exports * remove script tag require * webpack config ProvidePlugin Note that this commit only fix JavaScript module loading runtime error. --- webpack.config.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'webpack.config.js') diff --git a/webpack.config.js b/webpack.config.js index 01adea94..af001444 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -12,7 +12,12 @@ module.exports = { "window.jQuery": "jquery", Visibility: "visibilityjs", Cookies: "js-cookie", - CodeMirror: "codemirror" + CodeMirror: "codemirror", + emojify: "emojify.js", + ot: "ot", + io: "socket.io-client", + LZString: "lz-string", + key: "keymaster" }), new webpack.DefinePlugin({ "require.specified": "require.resolve" -- cgit v1.2.3 From 8e2b03cfd6d389df454d4baed68837c84e64ae66 Mon Sep 17 00:00:00 2001 From: Yukai Huang Date: Sat, 8 Oct 2016 23:04:19 +0800 Subject: Config bootstrap with webpack --- webpack.config.js | 125 +++++++++++++++++++++++++++++------------------------- 1 file changed, 67 insertions(+), 58 deletions(-) (limited to 'webpack.config.js') diff --git a/webpack.config.js b/webpack.config.js index af001444..26eeed58 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -3,67 +3,76 @@ var path = require('path'); var ExtractTextPlugin = require("extract-text-webpack-plugin"); module.exports = { - plugins: [ - new webpack.ProvidePlugin({ - '_': 'lodash', - jquery: "jquery", - jQuery: "jquery", - $: "jquery", - "window.jQuery": "jquery", - Visibility: "visibilityjs", - Cookies: "js-cookie", - CodeMirror: "codemirror", - emojify: "emojify.js", - ot: "ot", - io: "socket.io-client", - LZString: "lz-string", - key: "keymaster" - }), - new webpack.DefinePlugin({ - "require.specified": "require.resolve" - }) - ], + plugins: [ + new webpack.ProvidePlugin({ + '_': 'lodash', + jquery: "jquery", + jQuery: "jquery", + $: "jquery", + "window.jQuery": "jquery", + Visibility: "visibilityjs", + Cookies: "js-cookie", + CodeMirror: "codemirror", + emojify: "emojify.js", + ot: "ot", + io: "socket.io-client", + LZString: "lz-string", + key: "keymaster" + }), + new webpack.DefinePlugin({ + "require.specified": "require.resolve" + }) + ], - entry: { - app: path.join(__dirname, 'public/js/app.js') - }, + entry: { + app: path.join(__dirname, 'public/js/app.js') + }, - output: { - path: path.join(__dirname, 'public/build/js'), - filename: '[name].js' - }, + output: { + path: path.join(__dirname, 'public/build/js'), + filename: '[name].js' + }, - resolve: { - root: [ - path.resolve(__dirname, 'src'), - path.resolve(__dirname, 'node_modules') - ], - extensions: ["", ".js"], - alias: { - 'jquery-ui': 'jquery-ui/ui/widgets' - } - }, + resolve: { + root: [ + path.resolve(__dirname, 'src'), + path.resolve(__dirname, 'node_modules') + ], + extensions: ["", ".js"], + alias: { + 'jquery-ui': 'jquery-ui/ui/widgets' + } + }, - module: { - loaders: [{ - test: /\.json$/, - loader: 'json-loader' - }, { - test: /\.css$/, - loader: ExtractTextPlugin.extract({ - fallbackLoader: "style-loader", - loader: "css-loader" - }) - }, { - test: /\.scss$/, - loaders: ['style', 'css', 'sass'] - }, { - test: require.resolve("js-sequence-diagrams"), - loader: "imports?Raphael=raphael" - }] - }, + module: { + loaders: [{ + test: /\.json$/, + loader: 'json-loader' + }, { + test: /\.css$/, + loader: 'style-loader!css-loader' + }, , { + test: /\.scss$/, + loaders: ['style', 'css', 'sass'] + }, { + test: require.resolve("js-sequence-diagrams"), + loader: "imports?Raphael=raphael" + }, { + test: /\.eot(\?v=\d+\.\d+\.\d+)?$/, + loader: "file" + }, { + test: /\.(woff|woff2)$/, + loader: "url?prefix=font/&limit=5000" + }, { + test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, + loader: "url?limit=10000&mimetype=application/octet-stream" + }, { + test: /\.svg(\?v=\d+\.\d+\.\d+)?$/, + loader: "url?limit=10000&mimetype=image/svg+xml" + }] + }, - node: { - fs: "empty" - } + node: { + fs: "empty" + } }; -- cgit v1.2.3 From 7e6b9f776ff18e77425bafaed76ede70fe712189 Mon Sep 17 00:00:00 2001 From: Yukai Huang Date: Sun, 9 Oct 2016 08:15:23 +0800 Subject: Revert customized ot library and fix dependency --- webpack.config.js | 1 - 1 file changed, 1 deletion(-) (limited to 'webpack.config.js') diff --git a/webpack.config.js b/webpack.config.js index 26eeed58..9959a1ee 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -14,7 +14,6 @@ module.exports = { Cookies: "js-cookie", CodeMirror: "codemirror", emojify: "emojify.js", - ot: "ot", io: "socket.io-client", LZString: "lz-string", key: "keymaster" -- cgit v1.2.3 From 3e2905be13551a0cceeb18e72242be891db10db7 Mon Sep 17 00:00:00 2001 From: Yukai Huang Date: Sun, 9 Oct 2016 17:54:51 +0800 Subject: Revert to customized codemirror --- webpack.config.js | 1 - 1 file changed, 1 deletion(-) (limited to 'webpack.config.js') diff --git a/webpack.config.js b/webpack.config.js index 9959a1ee..85e3a005 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -12,7 +12,6 @@ module.exports = { "window.jQuery": "jquery", Visibility: "visibilityjs", Cookies: "js-cookie", - CodeMirror: "codemirror", emojify: "emojify.js", io: "socket.io-client", LZString: "lz-string", -- cgit v1.2.3 From 28858288fbc386350022bc4830775d21af217c11 Mon Sep 17 00:00:00 2001 From: Yukai Huang Date: Sun, 9 Oct 2016 17:55:07 +0800 Subject: Fix more js errors --- webpack.config.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'webpack.config.js') diff --git a/webpack.config.js b/webpack.config.js index 85e3a005..cad356fb 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -15,7 +15,8 @@ module.exports = { emojify: "emojify.js", io: "socket.io-client", LZString: "lz-string", - key: "keymaster" + key: "keymaster", + Viz: "viz.js" }), new webpack.DefinePlugin({ "require.specified": "require.resolve" -- cgit v1.2.3 From d0997ed0c18de0f17ea2f9435558f88e3f0fdd1c Mon Sep 17 00:00:00 2001 From: Yukai Huang Date: Sun, 9 Oct 2016 18:08:46 +0800 Subject: Config TextExtract plugin and change build folder --- webpack.config.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'webpack.config.js') diff --git a/webpack.config.js b/webpack.config.js index cad356fb..8fce2653 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -20,7 +20,8 @@ module.exports = { }), new webpack.DefinePlugin({ "require.specified": "require.resolve" - }) + }), + new ExtractTextPlugin("[name].css") ], entry: { @@ -28,7 +29,7 @@ module.exports = { }, output: { - path: path.join(__dirname, 'public/build/js'), + path: path.join(__dirname, 'public/build'), filename: '[name].js' }, @@ -49,10 +50,10 @@ module.exports = { loader: 'json-loader' }, { test: /\.css$/, - loader: 'style-loader!css-loader' + loader: ExtractTextPlugin.extract('style-loader', 'css-loader') }, , { test: /\.scss$/, - loaders: ['style', 'css', 'sass'] + loader: ExtractTextPlugin.extract('style-loader', 'sass-loader') }, { test: require.resolve("js-sequence-diagrams"), loader: "imports?Raphael=raphael" -- cgit v1.2.3 From 53b5cbb89325f4acb239afb188c4bbabe1ea8189 Mon Sep 17 00:00:00 2001 From: Yukai Huang Date: Sun, 9 Oct 2016 21:09:22 +0800 Subject: Finish public note view js loading --- webpack.config.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'webpack.config.js') diff --git a/webpack.config.js b/webpack.config.js index 8fce2653..186876a5 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -25,7 +25,8 @@ module.exports = { ], entry: { - app: path.join(__dirname, 'public/js/app.js') + app: path.join(__dirname, 'public/js/app.js'), + public: path.join(__dirname, 'public/js/public.js') }, output: { -- cgit v1.2.3 From 70c20aaddaff75c3d0b7eb0fd53da13bb5651387 Mon Sep 17 00:00:00 2001 From: Yukai Huang Date: Sun, 9 Oct 2016 21:47:29 +0800 Subject: Remove redundant entry point --- webpack.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'webpack.config.js') diff --git a/webpack.config.js b/webpack.config.js index 186876a5..ee2abc73 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -25,7 +25,7 @@ module.exports = { ], entry: { - app: path.join(__dirname, 'public/js/app.js'), + index: path.join(__dirname, 'public/js/index.js'), public: path.join(__dirname, 'public/js/public.js') }, -- cgit v1.2.3 From 082178d535fd15a49d7157268c62f297af5a27ff Mon Sep 17 00:00:00 2001 From: Yukai Huang Date: Mon, 10 Oct 2016 08:25:35 +0800 Subject: Slide mode is now working --- webpack.config.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'webpack.config.js') diff --git a/webpack.config.js b/webpack.config.js index ee2abc73..17e05226 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -26,7 +26,8 @@ module.exports = { entry: { index: path.join(__dirname, 'public/js/index.js'), - public: path.join(__dirname, 'public/js/public.js') + public: path.join(__dirname, 'public/js/public.js'), + slide: path.join(__dirname, 'public/js/slide.js') }, output: { @@ -52,9 +53,12 @@ module.exports = { }, { test: /\.css$/, loader: ExtractTextPlugin.extract('style-loader', 'css-loader') - }, , { + }, { test: /\.scss$/, loader: ExtractTextPlugin.extract('style-loader', 'sass-loader') + }, { + test: /\.less$/, + loader: ExtractTextPlugin.extract('style-loader', 'less-loader') }, { test: require.resolve("js-sequence-diagrams"), loader: "imports?Raphael=raphael" -- cgit v1.2.3 From 8cd1cf30a5f0f3b04222623998db4608a584e29d Mon Sep 17 00:00:00 2001 From: Yukai Huang Date: Mon, 10 Oct 2016 10:13:40 +0800 Subject: Include jquery by script tag for now --- webpack.config.js | 4 ---- 1 file changed, 4 deletions(-) (limited to 'webpack.config.js') diff --git a/webpack.config.js b/webpack.config.js index 17e05226..a4fabde7 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -6,10 +6,6 @@ module.exports = { plugins: [ new webpack.ProvidePlugin({ '_': 'lodash', - jquery: "jquery", - jQuery: "jquery", - $: "jquery", - "window.jQuery": "jquery", Visibility: "visibilityjs", Cookies: "js-cookie", emojify: "emojify.js", -- cgit v1.2.3 From 20f2e27350dba2f77199b434a4c236073f1aae04 Mon Sep 17 00:00:00 2001 From: Yukai Huang Date: Mon, 10 Oct 2016 10:14:17 +0800 Subject: Cover page is now working --- webpack.config.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'webpack.config.js') diff --git a/webpack.config.js b/webpack.config.js index a4fabde7..5a7d6718 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -23,7 +23,8 @@ module.exports = { entry: { index: path.join(__dirname, 'public/js/index.js'), public: path.join(__dirname, 'public/js/public.js'), - slide: path.join(__dirname, 'public/js/slide.js') + slide: path.join(__dirname, 'public/js/slide.js'), + locale: path.join(__dirname, 'public/js/locale.js') }, output: { -- cgit v1.2.3 From 9c8752d4521c7cffccf4313eca5cd6ff4f88c305 Mon Sep 17 00:00:00 2001 From: Yukai Huang Date: Tue, 11 Oct 2016 12:30:30 +0800 Subject: Split common vendor javascript into chunks --- webpack.config.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'webpack.config.js') diff --git a/webpack.config.js b/webpack.config.js index 5a7d6718..de2bb8b6 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -17,14 +17,26 @@ module.exports = { new webpack.DefinePlugin({ "require.specified": "require.resolve" }), - new ExtractTextPlugin("[name].css") + new ExtractTextPlugin("[name].css"), + new webpack.optimize.CommonsChunkPlugin({ + name: "vendor", + filename: "vendor.bundle.js", + minChunks: Infinity, + }) ], entry: { index: path.join(__dirname, 'public/js/index.js'), public: path.join(__dirname, 'public/js/public.js'), slide: path.join(__dirname, 'public/js/slide.js'), - locale: path.join(__dirname, 'public/js/locale.js') + locale: path.join(__dirname, 'public/js/locale.js'), + vendor: [ + "expose?$!expose?jQuery!jquery", + "jquery-textcomplete", + "jquery-mousewheel", + "jquery-scrollspy/jquery-scrollspy", + "bootstrap" + ] }, output: { -- cgit v1.2.3 From 06437ccaa995afc48e30154c136c4e485ac04ae7 Mon Sep 17 00:00:00 2001 From: Yukai Huang Date: Tue, 11 Oct 2016 14:52:45 +0800 Subject: Manage more packages with npm and webpack --- webpack.config.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'webpack.config.js') diff --git a/webpack.config.js b/webpack.config.js index de2bb8b6..6d99381c 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -10,9 +10,7 @@ module.exports = { Cookies: "js-cookie", emojify: "emojify.js", io: "socket.io-client", - LZString: "lz-string", - key: "keymaster", - Viz: "viz.js" + key: "keymaster" }), new webpack.DefinePlugin({ "require.specified": "require.resolve" @@ -35,6 +33,10 @@ module.exports = { "jquery-textcomplete", "jquery-mousewheel", "jquery-scrollspy/jquery-scrollspy", + "expose?LZString!lz-string", + "expose?filterXSS!xss", + "expose?Viz!viz.js", + "js-url", "bootstrap" ] }, -- cgit v1.2.3 From f9e7f482d307f89af8a4281a7bdb719297f07c21 Mon Sep 17 00:00:00 2001 From: Yukai Huang Date: Tue, 11 Oct 2016 15:45:00 +0800 Subject: Setup webpack production config --- webpack.config.js | 95 ++----------------------------------------------------- 1 file changed, 2 insertions(+), 93 deletions(-) (limited to 'webpack.config.js') diff --git a/webpack.config.js b/webpack.config.js index 6d99381c..d2cf3dc7 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,94 +1,3 @@ -var webpack = require('webpack'); -var path = require('path'); -var ExtractTextPlugin = require("extract-text-webpack-plugin"); +var baseConfig = require('./webpackBaseConfig'); -module.exports = { - plugins: [ - new webpack.ProvidePlugin({ - '_': 'lodash', - Visibility: "visibilityjs", - Cookies: "js-cookie", - emojify: "emojify.js", - io: "socket.io-client", - key: "keymaster" - }), - new webpack.DefinePlugin({ - "require.specified": "require.resolve" - }), - new ExtractTextPlugin("[name].css"), - new webpack.optimize.CommonsChunkPlugin({ - name: "vendor", - filename: "vendor.bundle.js", - minChunks: Infinity, - }) - ], - - entry: { - index: path.join(__dirname, 'public/js/index.js'), - public: path.join(__dirname, 'public/js/public.js'), - slide: path.join(__dirname, 'public/js/slide.js'), - locale: path.join(__dirname, 'public/js/locale.js'), - vendor: [ - "expose?$!expose?jQuery!jquery", - "jquery-textcomplete", - "jquery-mousewheel", - "jquery-scrollspy/jquery-scrollspy", - "expose?LZString!lz-string", - "expose?filterXSS!xss", - "expose?Viz!viz.js", - "js-url", - "bootstrap" - ] - }, - - output: { - path: path.join(__dirname, 'public/build'), - filename: '[name].js' - }, - - resolve: { - root: [ - path.resolve(__dirname, 'src'), - path.resolve(__dirname, 'node_modules') - ], - extensions: ["", ".js"], - alias: { - 'jquery-ui': 'jquery-ui/ui/widgets' - } - }, - - module: { - loaders: [{ - test: /\.json$/, - loader: 'json-loader' - }, { - test: /\.css$/, - loader: ExtractTextPlugin.extract('style-loader', 'css-loader') - }, { - test: /\.scss$/, - loader: ExtractTextPlugin.extract('style-loader', 'sass-loader') - }, { - test: /\.less$/, - loader: ExtractTextPlugin.extract('style-loader', 'less-loader') - }, { - test: require.resolve("js-sequence-diagrams"), - loader: "imports?Raphael=raphael" - }, { - test: /\.eot(\?v=\d+\.\d+\.\d+)?$/, - loader: "file" - }, { - test: /\.(woff|woff2)$/, - loader: "url?prefix=font/&limit=5000" - }, { - test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, - loader: "url?limit=10000&mimetype=application/octet-stream" - }, { - test: /\.svg(\?v=\d+\.\d+\.\d+)?$/, - loader: "url?limit=10000&mimetype=image/svg+xml" - }] - }, - - node: { - fs: "empty" - } -}; +module.exports = baseConfig; -- cgit v1.2.3