fixed tests

This commit is contained in:
lotte
2019-04-23 14:35:40 +02:00
committed by Art Lowel
parent 8a32777802
commit cfcf496cc1
4 changed files with 88 additions and 74 deletions

View File

@@ -1,13 +1,50 @@
const { const {
join, join,
resolve resolve,
} = require('path'); } = require('path');
function root(path) { function root(path) {
return resolve(__dirname, '..', path); return resolve(__dirname, '..', path);
} }
const theme = '';
// const theme = 'mantis';
const globalCSSImports = [
resolve(__dirname, '..', 'src/styles/_variables.scss'),
resolve(__dirname, '..', 'src/styles/_mixins.scss'),
];
const themeReplaceOptions =
{
multiple: [
{
search: '$theme$.',
replace: theme + (theme.length ? '.' : ''),
},
{
search: '$themePath$/',
replace: (theme.length ? 'themes/' : ''),
},
{
search: '$theme$.',
replace: (theme.length ? theme + '.' : ''),
},
{
search: '$themePath$/',
replace: (theme.length ? 'themes/' : ''),
}
]
};
module.exports = { module.exports = {
root: root, root: root,
join: join join: join,
theme: theme,
globalCSSImports: globalCSSImports,
themeReplaceOptions: themeReplaceOptions
}; };

View File

@@ -2,40 +2,12 @@ const CopyWebpackPlugin = require('copy-webpack-plugin');
const path = require('path'); const path = require('path');
const { const {
root, root,
join join,
globalCSSImports,
themeReplaceOptions
} = require('./helpers'); } = require('./helpers');
// const theme = '';
const theme = 'mantis';
const globalCSSImports = [
path.resolve(__dirname, '..', 'src/styles/_variables.scss'),
path.resolve(__dirname, '..', 'src/styles/_mixins.scss'),
];
const themeReplaceOptions =
{
multiple: [
{
search: '$theme$.',
replace: theme + (theme.length ? '.' : ''),
},
{
search: '$themePath$/',
replace: (theme.length ? 'themes/' : ''),
},
{
search: '$theme$.',
replace: (theme.length ? theme + '.' : ''),
},
{
search: '$themePath$/',
replace: (theme.length ? 'themes/' : ''),
}
]
};
module.exports = { module.exports = {
mode: 'development', mode: 'development',
devtool: 'source-map', devtool: 'source-map',

View File

@@ -1,7 +1,7 @@
var nodeExternals = require('webpack-node-externals'); var nodeExternals = require('webpack-node-externals');
const { const {
root root
} = require('./helpers'); } = require('./helpers');
module.exports = { module.exports = {
@@ -12,7 +12,8 @@ module.exports = {
output: { output: {
filename: 'server.js' filename: 'server.js'
}, },
target: 'node', module: {rules: []},
target: 'node',
externals: [nodeExternals({ externals: [nodeExternals({
whitelist: [ whitelist: [
/@angular/, /@angular/,

View File

@@ -1,5 +1,7 @@
const { const {
root root,
globalCSSImports,
themeReplaceOptions
} = require('./helpers'); } = require('./helpers');
/** /**
@@ -80,7 +82,11 @@ module.exports = function (options) {
exclude: [/node_modules/], exclude: [/node_modules/],
}, },
{
test: /\.component.ts$/,
loader: 'string-replace-loader',
options: themeReplaceOptions
},
/** /**
* Typescript loader support for .ts and Angular 2 async routes via .async.ts * Typescript loader support for .ts and Angular 2 async routes via .async.ts
* *
@@ -127,7 +133,6 @@ module.exports = function (options) {
} }
} }
], ],
exclude: [root('src/index.html')]
}, },
/** /**
@@ -136,39 +141,38 @@ module.exports = function (options) {
* *
*/ */
{ {
test: /\.scss$/, test: /\.scss$/,
use: [{ use: [
loader: 'to-string-loader', {
options: { loader: 'raw-loader',
sourceMap: true options: {
} sourceMap: true
}, { }
loader: 'raw-loader', },
options: { {
sourceMap: true loader: 'resolve-url-loader',
} options: {
}, sourceMap: true
{ }
loader: 'postcss-loader', },
options: { {
sourceMap: true loader: 'sass-loader',
} options: {
}, sourceMap: true
{ }
loader: 'resolve-url-loader', },
options: { {
sourceMap: true loader: 'string-replace-loader',
} options: themeReplaceOptions
}, },
{ {
loader: 'sass-loader', loader: 'sass-resources-loader',
options: { options: {
sourceMap: true resources: globalCSSImports
} },
}, },
'webpack-import-glob-loader' 'webpack-import-glob-loader'
], ]
exclude: [root('src/index.html')]
}, },
/** /**