Initial template cleanup and submit config
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
This commit is contained in:
parent
f99c04b56b
commit
81b2e9a537
9566
js/submit.js
9566
js/submit.js
File diff suppressed because it is too large
Load diff
11
js/survey.jquery.min.js
vendored
11
js/survey.jquery.min.js
vendored
File diff suppressed because one or more lines are too long
|
@ -56,6 +56,7 @@ use OCP\Util;
|
||||||
|
|
||||||
class PageController extends Controller {
|
class PageController extends Controller {
|
||||||
|
|
||||||
|
protected $appName;
|
||||||
private $userId;
|
private $userId;
|
||||||
private $formMapper;
|
private $formMapper;
|
||||||
private $submissionMapper;
|
private $submissionMapper;
|
||||||
|
@ -71,24 +72,23 @@ class PageController extends Controller {
|
||||||
/** @var ILogger */
|
/** @var ILogger */
|
||||||
private $logger;
|
private $logger;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(string $appName,
|
||||||
IRequest $request,
|
IRequest $request,
|
||||||
IUserManager $userMgr,
|
IUserManager $userMgr,
|
||||||
IGroupManager $groupManager,
|
IGroupManager $groupManager,
|
||||||
IURLGenerator $urlGenerator,
|
IURLGenerator $urlGenerator,
|
||||||
$userId,
|
FormMapper $formMapper,
|
||||||
FormMapper $formMapper,
|
$userId,
|
||||||
|
QuestionMapper $questionMapper,
|
||||||
QuestionMapper $questionMapper,
|
OptionMapper $optionMapper,
|
||||||
OptionMapper $optionMapper,
|
SubmissionMapper $SubmissionMapper,
|
||||||
SubmissionMapper $SubmissionMapper,
|
AnswerMapper $AnswerMapper,
|
||||||
AnswerMapper $AnswerMapper,
|
ILogger $logger) {
|
||||||
ILogger $logger
|
|
||||||
) {
|
|
||||||
parent::__construct(Application::APP_ID, $request);
|
parent::__construct(Application::APP_ID, $request);
|
||||||
$this->userMgr = $userMgr;
|
$this->userMgr = $userMgr;
|
||||||
$this->groupManager = $groupManager;
|
$this->groupManager = $groupManager;
|
||||||
$this->urlGenerator = $urlGenerator;
|
$this->urlGenerator = $urlGenerator;
|
||||||
|
$this->appName = $appName;
|
||||||
$this->userId = $userId;
|
$this->userId = $userId;
|
||||||
$this->formMapper = $formMapper;
|
$this->formMapper = $formMapper;
|
||||||
|
|
||||||
|
@ -167,31 +167,29 @@ class PageController extends Controller {
|
||||||
* @return TemplateResponse
|
* @return TemplateResponse
|
||||||
*/
|
*/
|
||||||
public function gotoForm($hash): ?TemplateResponse {
|
public function gotoForm($hash): ?TemplateResponse {
|
||||||
|
// Inject style on all templates
|
||||||
|
Util::addStyle($this->appName, 'forms');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$form = $this->formMapper->findByHash($hash);
|
$form = $this->formMapper->findByHash($hash);
|
||||||
} catch (DoesNotExistException $e) {
|
} catch (DoesNotExistException $e) {
|
||||||
return new TemplateResponse('forms', 'no.acc.tmpl', []);
|
return new TemplateResponse('forms', 'notfound');
|
||||||
}
|
|
||||||
|
|
||||||
// If form expired, return Expired-Template
|
|
||||||
if ( ($form->getExpires() !== 0) && (time() > $form->getExpires()) ) {
|
|
||||||
return new TemplateResponse('forms', 'expired.tmpl');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Does the user have permissions to display
|
||||||
if ($this->hasUserAccess($form)) {
|
if ($this->hasUserAccess($form)) {
|
||||||
$renderAs = $this->userId !== null ? 'user' : 'public';
|
return new TemplateResponse('forms', 'notfound');
|
||||||
$res = new TemplateResponse('forms', 'submit.tmpl', [
|
|
||||||
'form' => $form,
|
|
||||||
'questions' => $this->getQuestions($form->getId()),
|
|
||||||
], $renderAs);
|
|
||||||
$csp = new ContentSecurityPolicy();
|
|
||||||
$csp->allowEvalScript(true);
|
|
||||||
$res->setContentSecurityPolicy($csp);
|
|
||||||
return $res;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
User::checkLoggedIn();
|
// Has form expired
|
||||||
return new TemplateResponse('forms', 'no.acc.tmpl', []);
|
if ($form->getExpires() !== 0 && time() > $form->getExpires()) {
|
||||||
|
return new TemplateResponse('forms', 'expired');
|
||||||
|
}
|
||||||
|
|
||||||
|
$renderAs = is_null($this->userId) ? 'user' : 'public';
|
||||||
|
|
||||||
|
Util::addScript($this->appName, 'submit');
|
||||||
|
return new TemplateResponse($this->appName, 'main', [], $renderAs);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -57,8 +57,7 @@ __webpack_nonce__ = btoa(getRequestToken())
|
||||||
// eslint-disable-next-line
|
// eslint-disable-next-line
|
||||||
__webpack_public_path__ = generateFilePath('forms', '', 'js/')
|
__webpack_public_path__ = generateFilePath('forms', '', 'js/')
|
||||||
|
|
||||||
/* eslint-disable-next-line no-new */
|
export default new Vue({
|
||||||
new Vue({
|
|
||||||
el: '#content',
|
el: '#content',
|
||||||
// eslint-disable-next-line vue/match-component-file-name
|
// eslint-disable-next-line vue/match-component-file-name
|
||||||
name: 'FormsRoot',
|
name: 'FormsRoot',
|
||||||
|
|
36
src/submit.js
Normal file
36
src/submit.js
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
/**
|
||||||
|
* @copyright Copyright (c) 2020 John Molakvoæ <skjnldsv@protonmail.com>
|
||||||
|
*
|
||||||
|
* @author John Molakvoæ <skjnldsv@protonmail.com>
|
||||||
|
*
|
||||||
|
* @license GNU AGPL version 3 or any later version
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as
|
||||||
|
* published by the Free Software Foundation, either version 3 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { translate, translatePlural } from '@nextcloud/l10n'
|
||||||
|
import Vue from 'vue'
|
||||||
|
|
||||||
|
import Fill from './views/Submit'
|
||||||
|
|
||||||
|
Vue.prototype.t = translate
|
||||||
|
Vue.prototype.n = translatePlural
|
||||||
|
|
||||||
|
export default new Vue({
|
||||||
|
el: '#content',
|
||||||
|
// eslint-disable-next-line vue/match-component-file-name
|
||||||
|
name: 'FormsSubmitRoot',
|
||||||
|
render: h => h(Fill),
|
||||||
|
})
|
|
@ -26,6 +26,6 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
name: 'Fill',
|
name: 'Submit',
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
31
templates/expired.php
Normal file
31
templates/expired.php
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @copyright Copyright (c) 2019 Inigo Jiron <ijiron@terpmail.umd.edu>
|
||||||
|
*
|
||||||
|
* @author Inigo Jiron <ijiron@terpmail.umd.edu>
|
||||||
|
* @author John Molakvoæ <skjnldsv@protonmail.com>
|
||||||
|
*
|
||||||
|
* @license GNU AGPL version 3 or any later version
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as
|
||||||
|
* published by the Free Software Foundation, either version 3 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
?>
|
||||||
|
<div id="emptycontent" class="">
|
||||||
|
<div class="icon-forms"></div>
|
||||||
|
<h2><?php p($l->t('Form Expired')); ?></h2>
|
||||||
|
<p><?php p($l->t('This Form has expired and is no longer taking answers')); ?></p>
|
||||||
|
</div>
|
|
@ -1,35 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* @copyright Copyright (c) 2019 Inigo Jiron <ijiron@terpmail.umd.edu>
|
|
||||||
*
|
|
||||||
* @author Inigo Jiron <ijiron@terpmail.umd.edu>
|
|
||||||
*
|
|
||||||
* @license GNU AGPL version 3 or any later version
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Affero General Public License as
|
|
||||||
* published by the Free Software Foundation, either version 3 of the
|
|
||||||
* License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
use OCP\Util;
|
|
||||||
Util::addStyle('forms', 'main');
|
|
||||||
?>
|
|
||||||
<div id="emptycontent" class="">
|
|
||||||
<div class="icon-forms"></div>
|
|
||||||
<h1>
|
|
||||||
<?php p($l->t('Form Expired')); ?>
|
|
||||||
</h1>
|
|
||||||
<h2>
|
|
||||||
<?php p($l->t('This Form has expired and is no longer taking answers.')); ?>
|
|
||||||
</h2>
|
|
||||||
</div>
|
|
|
@ -1,28 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* @copyright Copyright (c) 2017 Vinzenz Rosenkranz <vinzenz.rosenkranz@gmail.com>
|
|
||||||
*
|
|
||||||
* @author Vinzenz Rosenkranz <vinzenz.rosenkranz@gmail.com>
|
|
||||||
* @author René Gieling <github@dartcafe.de>
|
|
||||||
*
|
|
||||||
* @license GNU AGPL version 3 or any later version
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Affero General Public License as
|
|
||||||
* published by the Free Software Foundation, either version 3 of the
|
|
||||||
* License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
||||||
<?php \OCP\Util::addScript('forms', 'forms'); ?>
|
|
||||||
<div id="app-forms" value = 'forms'></div>
|
|
|
@ -1,35 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* @copyright Copyright (c) 2017 Vinzenz Rosenkranz <vinzenz.rosenkranz@gmail.com>
|
|
||||||
*
|
|
||||||
* @author Vinzenz Rosenkranz <vinzenz.rosenkranz@gmail.com>
|
|
||||||
*
|
|
||||||
* @license GNU AGPL version 3 or any later version
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Affero General Public License as
|
|
||||||
* published by the Free Software Foundation, either version 3 of the
|
|
||||||
* License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
use OCP\Util;
|
|
||||||
Util::addStyle('forms', 'main');
|
|
||||||
?>
|
|
||||||
<div id="emptycontent" class="">
|
|
||||||
<div class="icon-forms"></div>
|
|
||||||
<h1>
|
|
||||||
<?php p($l->t('Access denied')); ?>
|
|
||||||
</h1>
|
|
||||||
<h2>
|
|
||||||
<?php p($l->t('You are not allowed to view this form or the form does not exist.')); ?>
|
|
||||||
</h2>
|
|
||||||
</div>
|
|
|
@ -1,35 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* @copyright Copyright (c) 2017 Vinzenz Rosenkranz <vinzenz.rosenkranz@gmail.com>
|
|
||||||
*
|
|
||||||
* @author Vinzenz Rosenkranz <vinzenz.rosenkranz@gmail.com>
|
|
||||||
*
|
|
||||||
* @license GNU AGPL version 3 or any later version
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Affero General Public License as
|
|
||||||
* published by the Free Software Foundation, either version 3 of the
|
|
||||||
* License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
use OCP\Util;
|
|
||||||
Util::addStyle('forms', 'main');
|
|
||||||
?>
|
|
||||||
<div id="emptycontent" class="">
|
|
||||||
<div class="icon-forms"></div>
|
|
||||||
<h1>
|
|
||||||
<?php p($l->t('Access denied')); ?>
|
|
||||||
</h1>
|
|
||||||
<h2>
|
|
||||||
<?php p($l->t('You are not allowed to edit this form or the form does not exist.')); ?>
|
|
||||||
</h2>
|
|
||||||
</div>
|
|
|
@ -1,35 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* @copyright Copyright (c) 2017 Vinzenz Rosenkranz <vinzenz.rosenkranz@gmail.com>
|
|
||||||
*
|
|
||||||
* @author Vinzenz Rosenkranz <vinzenz.rosenkranz@gmail.com>
|
|
||||||
*
|
|
||||||
* @license GNU AGPL version 3 or any later version
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Affero General Public License as
|
|
||||||
* published by the Free Software Foundation, either version 3 of the
|
|
||||||
* License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
use OCP\Util;
|
|
||||||
Util::addStyle('forms', 'main');
|
|
||||||
?>
|
|
||||||
<div id="emptycontent" class="">
|
|
||||||
<div class="icon-forms"></div>
|
|
||||||
<h1>
|
|
||||||
<?php p($l->t('Access denied')); ?>
|
|
||||||
</h1>
|
|
||||||
<h2>
|
|
||||||
<?php p($l->t('You are either not allowed to delete this form or it doesn\'t exist.')); ?>
|
|
||||||
</h2>
|
|
||||||
</div>
|
|
31
templates/notfound.php
Normal file
31
templates/notfound.php
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @copyright Copyright (c) 2019 Inigo Jiron <ijiron@terpmail.umd.edu>
|
||||||
|
*
|
||||||
|
* @author Inigo Jiron <ijiron@terpmail.umd.edu>
|
||||||
|
* @author John Molakvoæ <skjnldsv@protonmail.com>
|
||||||
|
*
|
||||||
|
* @license GNU AGPL version 3 or any later version
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as
|
||||||
|
* published by the Free Software Foundation, either version 3 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
?>
|
||||||
|
<div id="emptycontent" class="">
|
||||||
|
<div class="icon-forms"></div>
|
||||||
|
<h2><?php p($l->t('Form not found')); ?></h2>
|
||||||
|
<p><?php p($l->t('This form does not exists')); ?></p>
|
||||||
|
</div>
|
|
@ -1,45 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* @copyright Copyright (c) 2017 Vinzenz Rosenkranz <vinzenz.rosenkranz@gmail.com>
|
|
||||||
*
|
|
||||||
* @author Vinzenz Rosenkranz <vinzenz.rosenkranz@gmail.com>
|
|
||||||
*
|
|
||||||
* @license GNU AGPL version 3 or any later version
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Affero General Public License as
|
|
||||||
* published by the Free Software Foundation, either version 3 of the
|
|
||||||
* License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
use OCP\Util;
|
|
||||||
|
|
||||||
Util::addStyle('forms', 'submit');
|
|
||||||
|
|
||||||
Util::addScript('forms', 'submit');
|
|
||||||
Util::addScript('forms', 'survey.jquery.min');
|
|
||||||
|
|
||||||
/** @var \OCA\Forms\Db\Form $form */
|
|
||||||
$form = $_['form'];
|
|
||||||
/** @var OCA\Forms\Db\Question[] $questions */
|
|
||||||
$questions = $_['questions'];
|
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
||||||
<?php if ($form->getIsAnonymous()):?>
|
|
||||||
*NOTE: This form is anonymous
|
|
||||||
<?php endif?>
|
|
||||||
|
|
||||||
<div id="surveyContainer"
|
|
||||||
form="<?php echo htmlentities(json_encode($form->read()))?>"
|
|
||||||
questions="<?php echo htmlentities(json_encode($questions))?>"
|
|
||||||
></div>
|
|
|
@ -1,14 +1,23 @@
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
const { VueLoaderPlugin } = require('vue-loader')
|
const webpack = require('webpack')
|
||||||
|
|
||||||
const StyleLintPlugin = require('stylelint-webpack-plugin')
|
const StyleLintPlugin = require('stylelint-webpack-plugin')
|
||||||
|
const VueLoaderPlugin = require('vue-loader/lib/plugin')
|
||||||
|
|
||||||
|
const appName = process.env.npm_package_name
|
||||||
|
const appVersion = process.env.npm_package_version
|
||||||
|
console.info('Building', appName, appVersion, '\n')
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
entry: path.join(__dirname, 'src', 'main.js'),
|
entry: {
|
||||||
|
forms: path.resolve(path.join('src', 'main.js')),
|
||||||
|
submit: path.resolve(path.join('src', 'submit.js')),
|
||||||
|
},
|
||||||
output: {
|
output: {
|
||||||
path: path.resolve(__dirname, './js'),
|
path: path.resolve('./js'),
|
||||||
publicPath: '/js/',
|
publicPath: '/js/',
|
||||||
filename: 'forms.js',
|
filename: `[name].js`,
|
||||||
chunkFilename: 'chunks/[name].js',
|
chunkFilename: `${appName}.[name].js?v=[contenthash]`,
|
||||||
},
|
},
|
||||||
module: {
|
module: {
|
||||||
rules: [
|
rules: [
|
||||||
|
@ -36,18 +45,14 @@ module.exports = {
|
||||||
loader: 'babel-loader',
|
loader: 'babel-loader',
|
||||||
exclude: /node_modules/,
|
exclude: /node_modules/,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
test: /\.(png|jpg|gif|svg)$/,
|
|
||||||
loader: 'url-loader',
|
|
||||||
options: {
|
|
||||||
limit: 8192,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
new VueLoaderPlugin(),
|
new VueLoaderPlugin(),
|
||||||
new StyleLintPlugin(),
|
new StyleLintPlugin(),
|
||||||
|
// Make appName & appVersion available as a constant
|
||||||
|
new webpack.DefinePlugin({ appName }),
|
||||||
|
new webpack.DefinePlugin({ appVersion }),
|
||||||
],
|
],
|
||||||
resolve: {
|
resolve: {
|
||||||
extensions: ['*', '.js', '.vue'],
|
extensions: ['*', '.js', '.vue'],
|
||||||
|
|
Loading…
Reference in a new issue