New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to compiled handlebars #186

Merged
merged 3 commits into from Oct 23, 2018

Conversation

Projects
None yet
3 participants
@rullzer
Copy link
Member

rullzer commented Oct 15, 2018

  • Let webpack compile the templates
  • Remove online compilation
  • Recompile assets

Signed-off-by: Roeland Jago Douma roeland@famdouma.nl

@rullzer rullzer added this to the Nextcloud 15 milestone Oct 15, 2018

@rullzer rullzer requested review from nickvergessen and ChristophWurst Oct 15, 2018

}
]
},
plugins: [new VueLoaderPlugin()],
resolve: {
alias: {
vue$: 'vue/dist/vue.esm.js'
vue$: 'vue/dist/vue.esm.js',
'handlebars': 'handlebars/runtime.js'

This comment has been minimized.

@ChristophWurst

ChristophWurst Oct 15, 2018

Member

I don't think this alias is necessary now that templates are pre-compiled, the handlebars module isn't even used in the code.

This comment has been minimized.

@nickvergessen

nickvergessen Oct 23, 2018

Member

Works without, so I removed it again

rullzer and others added some commits Oct 15, 2018

Switch to compiled handlebars
* Let webpack compile the templates
* Remove online compilation
* Recompile assets

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Remove unrequired change
Signed-off-by: Joas Schilling <coding@schilljs.com>

@nickvergessen nickvergessen force-pushed the csp/handlebarscompilation branch from f46069f to e22661f Oct 23, 2018

@nickvergessen

This comment has been minimized.

Copy link
Member

nickvergessen commented Oct 23, 2018

While this works for make build-js-production it doesn't work for make build-js.
The problem is that still uses eval in the compiled JS:

 [Mitteilungsdetails anzeigen/ausblenden] Error: call to eval() blocked by CSP notifications.js:882:1
./src/init.js
https://nextcloud15.local/appsbabies/notifications/js/notifications.js:882:1
__webpack_require__
https://nextcloud15.local/appsbabies/notifications/js/notifications.js:20:12
<anonym>
https://nextcloud15.local/appsbabies/notifications/js/notifications.js:84:18
<anonym>
https://nextcloud15.local/appsbabies/notifications/js/notifications.js:1:11

Code in question (882 is the eval line)

/***/ "./src/init.js":
/*!*********************!*\
  !*** ./src/init.js ***!
  \*********************/
/*! no exports provided */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ \"./node_modules/vue/dist/vue.esm.js\");\n/* harmony import */ var _App__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./App */ \"./src/App.vue\");\n/**\n * @copyright Copyright (c) 2018 Joas Schilling <coding@schilljs.com>\n *\n * @license GNU AGPL version 3 or any later version\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n\nvue__WEBPACK_IMPORTED_MODULE_0__[\"default\"].prototype.t = t;\nvue__WEBPACK_IMPORTED_MODULE_0__[\"default\"].prototype.n = n;\nvue__WEBPACK_IMPORTED_MODULE_0__[\"default\"].prototype.OC = OC;\nvue__WEBPACK_IMPORTED_MODULE_0__[\"default\"].prototype.OCA = OCA;\n$('form.searchbox').after($('<div>').attr('id', 'notifications'));\nnew vue__WEBPACK_IMPORTED_MODULE_0__[\"default\"]({\n  el: '#notifications',\n  render: function render(h) {\n    return h(_App__WEBPACK_IMPORTED_MODULE_1__[\"default\"]);\n  }\n});\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9zcmMvaW5pdC5qcz9kOTllIl0sIm5hbWVzIjpbIlZ1ZSIsInByb3RvdHlw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hcmNoYm94JykuYWZ0ZXIoJCgnPGRpdj4nKS5hdHRyKCdpZCcsICdub3RpZmljYXRpb25zJykpO1xuXG5uZXcgVnVlKHtcblx0ZWw6ICcjbm90aWZpY2F0aW9ucycsXG5cdHJlbmRlcjogaCA9PiBoKEFwcClcbn0pO1xuIl0sInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///./src/init.js\n");

/***/ }),

Is this fixable @rullzer or out of your js/webpack knowledge?

@ChristophWurst

This comment has been minimized.

Copy link
Member

ChristophWurst commented Oct 23, 2018

devtool: '#eval-source-map',
-> pick a different one from https://webpack.js.org/configuration/devtool/

Fix dev build
Signed-off-by: Joas Schilling <coding@schilljs.com>
@nickvergessen

This comment has been minimized.

Copy link
Member

nickvergessen commented Oct 23, 2018

Excellent, thanks

@nickvergessen nickvergessen merged commit 7bf524d into master Oct 23, 2018

0 of 4 checks passed

Scrutinizer Running
Details
continuous-integration/drone/pr this build is pending
Details
continuous-integration/drone/push this build is pending
Details
continuous-integration/travis-ci/pr The Travis CI build is in progress
Details

@nickvergessen nickvergessen deleted the csp/handlebarscompilation branch Oct 23, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment