{"action":"created","issue":{"url":"https://api.github.com/repos/SharePoint/sp-dev-docs/issues/4692","repository_url":"https://api.github.com/repos/SharePoint/sp-dev-docs","labels_url":"https://api.github.com/repos/SharePoint/sp-dev-docs/issues/4692/labels{/name}","comments_url":"https://api.github.com/repos/SharePoint/sp-dev-docs/issues/4692/comments","events_url":"https://api.github.com/repos/SharePoint/sp-dev-docs/issues/4692/events","html_url":"https://github.com/SharePoint/sp-dev-docs/issues/4692","id":499574631,"node_id":"MDU6SXNzdWU0OTk1NzQ2MzE=","number":4692,"title":"Webpack configuration specifically because of empty rule tests","user":{"login":"StfBauer","id":5503835,"node_id":"MDQ6VXNlcjU1MDM4MzU=","avatar_url":"https://avatars3.githubusercontent.com/u/5503835?v=4","gravatar_id":"","url":"https://api.github.com/users/StfBauer","html_url":"https://github.com/StfBauer","followers_url":"https://api.github.com/users/StfBauer/followers","following_url":"https://api.github.com/users/StfBauer/following{/other_user}","gists_url":"https://api.github.com/users/StfBauer/gists{/gist_id}","starred_url":"https://api.github.com/users/StfBauer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/StfBauer/subscriptions","organizations_url":"https://api.github.com/users/StfBauer/orgs","repos_url":"https://api.github.com/users/StfBauer/repos","events_url":"https://api.github.com/users/StfBauer/events{/privacy}","received_events_url":"https://api.github.com/users/StfBauer/received_events","type":"User","site_admin":false},"labels":[{"id":1173740600,"node_id":"MDU6TGFiZWwxMTczNzQwNjAw","url":"https://api.github.com/repos/SharePoint/sp-dev-docs/labels/Needs:%20Attention%20:wave:","name":"Needs: Attention :wave:","color":"8c51c3","default":false},{"id":427067542,"node_id":"MDU6TGFiZWw0MjcwNjc1NDI=","url":"https://api.github.com/repos/SharePoint/sp-dev-docs/labels/area:tooling","name":"area:tooling","color":"e99695","default":false},{"id":422233696,"node_id":"MDU6TGFiZWw0MjIyMzM2OTY=","url":"https://api.github.com/repos/SharePoint/sp-dev-docs/labels/type:question","name":"type:question","color":"c2e0c6","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2019-09-27T18:00:12Z","updated_at":"2019-09-30T12:52:25Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"#### Category\r\n- [x] Question\r\n- [ ] Typo\r\n- [ ] Bug\r\n- [ ] Additional article idea\r\n\r\n#### Expected or Desired Behavior\r\nDocumentation on default webpack configuration. More specifically the generatedConfiguration.\r\n\r\n#### Observed Behavior\r\nI case additional loader or configuration changes should be added the webpack configuration the following script can be used:\r\n\r\n```javascript\r\nbuild.configureWebpack.mergeConfig({\r\n  additionalConfiguration: (generatedConfiguration) => {\r\n    /** Do something **/\r\n    return generatedConfiguration;\r\n  })\r\n}\r\n```\r\n\r\nThere is just one big question mark in case of the generatedConfiguration this object passed to the function contain the folliowing content.\r\n\r\n```json\r\n{\r\n  \"module\": {\r\n    \"rules\": [\r\n      {\r\n        \"use\": [\r\n          {\r\n            \"loader\": \"/Volumes/Code/research/webpack-performance/node_modules/@microsoft/loader-load-themed-styles/lib/index.js\",\r\n            \"options\": {\r\n              \"async\": true\r\n            }\r\n          },\r\n          {\r\n            \"loader\": \"/Volumes/Code/research/webpack-performance/node_modules/css-loader/index.js\",\r\n            \"options\": {\r\n              \"minimize\": true\r\n            }\r\n          }\r\n        ],\r\n        \"test\": {}\r\n      },\r\n      {\r\n        \"use\": [\r\n          {\r\n            \"loader\": \"/Volumes/Code/research/webpack-performance/node_modules/@microsoft/loader-cased-file/lib/index.js\",\r\n            \"options\": {\r\n              \"name\": \"[name:lower]_[hash].[ext]\"\r\n            }\r\n          }\r\n        ],\r\n        \"test\": {}\r\n      },\r\n      {\r\n        \"use\": [\r\n          {\r\n            \"loader\": \"/Volumes/Code/research/webpack-performance/node_modules/html-loader/index.js\"\r\n          }\r\n        ],\r\n        \"test\": {}\r\n      },\r\n      {\r\n        \"test\": {},\r\n        \"enforce\": \"pre\",\r\n        \"use\": \"/Volumes/Code/research/webpack-performance/node_modules/source-map-loader/index.js\"\r\n      }\r\n    ],\r\n    \"noParse\": [\r\n      {}\r\n    ]\r\n  },\r\n  \"resolve\": {\r\n    \"alias\": {},\r\n    \"modules\": [\r\n      \"node_modules\",\r\n      \"lib\"\r\n    ]\r\n  },\r\n  \"context\": \"/Volumes/Code/research/webpack-performance\",\r\n  \"devtool\": \"source-map\",\r\n  \"mode\": \"development\",\r\n  \"entry\": {\r\n    \"high-performance-web-part\": \"/Volumes/Code/research/webpack-performance/lib/webparts/highPerformance/HighPerformanceWebPart.js\"\r\n  },\r\n  \"externals\": [\r\n    \"@microsoft/sp-lodash-subset\",\r\n    \"@microsoft/sp-core-library\",\r\n    \"@microsoft/sp-office-ui-fabric-core\",\r\n    \"@microsoft/decorators\",\r\n    \"@microsoft/sp-diagnostics\",\r\n    \"@microsoft/sp-dynamic-data\",\r\n    \"@microsoft/sp-polyfills\",\r\n    \"@microsoft/sp-http\",\r\n    \"@microsoft/office-ui-fabric-react-bundle\",\r\n    \"@microsoft/sp-page-context\",\r\n    \"@microsoft/sp-loader\",\r\n    \"@microsoft/sp-component-base\",\r\n    \"@microsoft/sp-property-pane\",\r\n    \"@microsoft/sp-webpart-base\",\r\n    \"@microsoft/sp-extension-base\",\r\n    \"@microsoft/sp-application-base\",\r\n    \"@microsoft/sp-client-preview\",\r\n    \"@microsoft/sp-webpart-workbench\",\r\n    \"webpack-performance\",\r\n    \"react\",\r\n    \"react-dom\",\r\n    \"HighPerformanceWebPartStrings\"\r\n  ],\r\n  \"output\": {\r\n    \"chunkFilename\": \"[id].[name]_[chunkhash].js\",\r\n    \"filename\": \"[name].js\",\r\n    \"library\": \"8d5e0295-b233-4295-9930-9c048ba0438c_0.0.1\",\r\n    \"libraryTarget\": \"amd\",\r\n    \"path\": \"/Volumes/Code/research/webpack-performance/dist\",\r\n    \"devtoolModuleFilenameTemplate\": \"webpack:///../[resource-path]\",\r\n    \"devtoolFallbackModuleFilenameTemplate\": \"webpack:///../[resource-path]?[hash]\"\r\n  },\r\n  \"plugins\": [\r\n    {\r\n      \"options\": {\r\n        \"scriptName\": {\r\n          \"name\": \"\\\\/[name](_[a-z0-9-]+)*\\\\\\\\.js\",\r\n          \"isTokenized\": true\r\n        }\r\n      }\r\n    },\r\n    {\r\n      \"definitions\": {\r\n        \"process.env.NODE_ENV\": \"\\\"dev\\\"\",\r\n        \"DEBUG\": true,\r\n        \"DEPRECATED_UNIT_TEST\": false,\r\n        \"NPM_BUILD\": false,\r\n        \"DATACENTER\": true\r\n      }\r\n    }\r\n  ]\r\n}\r\n```\r\n\r\nMore specificly the rules all contains empty tests to check which file which loader should use. So the question is how does it work and is this supposed to work? Why multiple rules when basically are all for any project.\r\n\r\nI guess there must be some black magic happing with the webpack configuration behind the scenes because it basically works somehow.\r\n"},"comment":{"url":"https://api.github.com/repos/SharePoint/sp-dev-docs/issues/comments/536546959","html_url":"https://github.com/SharePoint/sp-dev-docs/issues/4692#issuecomment-536546959","issue_url":"https://api.github.com/repos/SharePoint/sp-dev-docs/issues/4692","id":536546959,"node_id":"MDEyOklzc3VlQ29tbWVudDUzNjU0Njk1OQ==","user":{"login":"andrewconnell","id":2068657,"node_id":"MDQ6VXNlcjIwNjg2NTc=","avatar_url":"https://avatars0.githubusercontent.com/u/2068657?v=4","gravatar_id":"","url":"https://api.github.com/users/andrewconnell","html_url":"https://github.com/andrewconnell","followers_url":"https://api.github.com/users/andrewconnell/followers","following_url":"https://api.github.com/users/andrewconnell/following{/other_user}","gists_url":"https://api.github.com/users/andrewconnell/gists{/gist_id}","starred_url":"https://api.github.com/users/andrewconnell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andrewconnell/subscriptions","organizations_url":"https://api.github.com/users/andrewconnell/orgs","repos_url":"https://api.github.com/users/andrewconnell/repos","events_url":"https://api.github.com/users/andrewconnell/events{/privacy}","received_events_url":"https://api.github.com/users/andrewconnell/received_events","type":"User","site_admin":false},"created_at":"2019-09-30T12:52:25Z","updated_at":"2019-09-30T12:52:25Z","author_association":"COLLABORATOR","body":"@StfBauer said:\r\n> Well not really. The \"In Memory\" webpack configuration is invalid where it will be applied and still has the same empty tests in there for one. (Could be that I look at the wrong place)\r\n\r\nThen how does it work if it's invalid? If you don't do anything, that's what it uses & it builds... so... what's invalid about it?\r\n\r\n@StfBauer said:\r\n> it doesn't make sense\r\n\r\nAgreed, but that's more a matter of opinion than a fact ;)"}}
{"actor":{"display_login":"andrewconnell"}}