@@ -42,11 +42,15 @@ module.exports = (env, argv) => [
4242// -----------
4343 // The primary config: client-side build. This config file contains `multiple targets <https://webpack.js.org/concepts/targets/#multiple-targets>`_.
4444 {
45+ // See `mode <https://webpack.js.org/configuration/mode/>`_ for the conditional statement below.
46+ devtool : argv . mode === "development" ? "inline-source-map" : "source-map" ,
4547 entry : {
4648 runestone : "./webpack.index.js" ,
4749 } ,
48- // See `mode <https://webpack.js.org/configuration/mode/>`_ for the conditional statement below.
49- devtool : argv . mode === "development" ? "inline-source-map" : "source-map" ,
50+ externals : {
51+ // Use the jQuery that Sphinx provides for jQuery.ui. See `externals <https://webpack.js.org/configuration/externals/>`_.
52+ jquery : "jQuery" ,
53+ } ,
5054 module : {
5155 rules : [
5256 {
@@ -60,25 +64,6 @@ module.exports = (env, argv) => [
6064 } ,
6165 ] ,
6266 } ,
63- resolve : {
64- fallback : {
65- // ``sql.js`` wants these in case it's running under node.js. They're not needed by JS in the browser.
66- "crypto" : false ,
67- "fs" : false ,
68- "path" : false
69- }
70- } ,
71- externals : {
72- // Use the jQuery that Sphinx provides for jQuery.ui. See `externals <https://webpack.js.org/configuration/externals/>`_.
73- jquery : "jQuery" ,
74- } ,
75- output : {
76- path : path . resolve ( __dirname , "runestone/dist" ) ,
77- // See https://webpack.js.org/guides/caching/. This provides a hash for dynamic imports as well, avoiding caching out-of-date JS.
78- filename : "[name].bundle.js?v=[contenthash]" ,
79- // Delete everything in the output directory on each build.
80- //clean: true,
81- } ,
8267 // See https://webpack.js.org/guides/code-splitting/#splitchunksplugin.
8368 optimization : {
8469 moduleIds : 'deterministic' ,
@@ -94,6 +79,13 @@ module.exports = (env, argv) => [
9479 new CssMinimizerPlugin ( ) ,
9580 ] ,
9681 } ,
82+ output : {
83+ path : path . resolve ( __dirname , "runestone/dist" ) ,
84+ // See https://webpack.js.org/guides/caching/. This provides a hash for dynamic imports as well, avoiding caching out-of-date JS.
85+ filename : "[name].bundle.js?v=[contenthash]" ,
86+ // Delete everything in the output directory on each build.
87+ //clean: true,
88+ } ,
9789 plugins : [
9890 // _`webpack_static_imports`: Instead of HTML, produce a list of static imports as JSON. Sphinx will then read this file and inject these imports when creating each page.
9991 new HtmlWebpackPlugin ( {
@@ -119,17 +111,25 @@ module.exports = (env, argv) => [
119111 chunkFilename : '[id].css' ,
120112 } ) ,
121113 ] ,
114+ resolve : {
115+ fallback : {
116+ // ``sql.js`` wants these in case it's running under node.js. They're not needed by JS in the browser.
117+ "crypto" : false ,
118+ "fs" : false ,
119+ "path" : false
120+ }
121+ } ,
122122 } ,
123123
124124// Server-side
125125// -----------
126126 // Config for server-side code.
127127 {
128+ // See `mode <https://webpack.js.org/configuration/mode/>`_ for the conditional statement below.
129+ devtool : argv . mode === "development" ? "inline-source-map" : "source-map" ,
128130 entry : {
129131 server_side : "./webpack.server-index.js" ,
130132 } ,
131- // See `mode <https://webpack.js.org/configuration/mode/>`_ for the conditional statement below.
132- devtool : argv . mode === "development" ? "inline-source-map" : "source-map" ,
133133 module : {
134134 rules : [
135135 {
0 commit comments