mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-08 02:24:11 +00:00
fixed webpack.test config
This commit is contained in:
@@ -1,8 +1,13 @@
|
|||||||
const {
|
const {
|
||||||
projectRoot,
|
projectRoot,
|
||||||
|
buildRoot,
|
||||||
|
themedTest,
|
||||||
|
themedUse,
|
||||||
|
themePath,
|
||||||
globalCSSImports,
|
globalCSSImports,
|
||||||
themeReplaceOptions
|
themeReplaceOptions
|
||||||
} = require('./helpers');
|
} = require('./helpers');
|
||||||
|
const path = require('path');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Webpack Plugins
|
* Webpack Plugins
|
||||||
@@ -25,7 +30,7 @@ const ENV = process.env.ENV = process.env.NODE_ENV = 'test';
|
|||||||
*
|
*
|
||||||
* See: http://webpack.github.io/docs/configuration.html#cli
|
* See: http://webpack.github.io/docs/configuration.html#cli
|
||||||
*/
|
*/
|
||||||
module.exports = function (options) {
|
module.exports = function (env) {
|
||||||
return {
|
return {
|
||||||
mode: 'development',
|
mode: 'development',
|
||||||
/**
|
/**
|
||||||
@@ -76,16 +81,12 @@ module.exports = function (options) {
|
|||||||
* See: https://github.com/webpack/source-map-loader
|
* See: https://github.com/webpack/source-map-loader
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
enforce: 'pre',
|
test: (filePath) => themedTest(filePath, 'scss'),
|
||||||
test: /\.js$/,
|
use: (info) => themedUse(info.resource, 'scss')
|
||||||
loader: 'source-map-loader',
|
|
||||||
exclude: [/node_modules/],
|
|
||||||
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
test: /\.component.ts$/,
|
test: (filePath) => themedTest(filePath, 'html'),
|
||||||
loader: 'string-replace-loader',
|
use: (info) => themedUse(info.resource, 'html')
|
||||||
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
|
||||||
@@ -142,6 +143,11 @@ module.exports = function (options) {
|
|||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
test: /\.scss$/,
|
test: /\.scss$/,
|
||||||
|
exclude: [
|
||||||
|
/node_modules/,
|
||||||
|
buildRoot('styles/_exposed_variables.scss', env),
|
||||||
|
buildRoot('styles/_variables.scss', env)
|
||||||
|
],
|
||||||
use: [
|
use: [
|
||||||
{
|
{
|
||||||
loader: 'raw-loader',
|
loader: 'raw-loader',
|
||||||
@@ -149,6 +155,12 @@ module.exports = function (options) {
|
|||||||
sourceMap: true
|
sourceMap: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
loader: 'postcss-loader',
|
||||||
|
options: {
|
||||||
|
sourceMap: true
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
loader: 'resolve-url-loader',
|
loader: 'resolve-url-loader',
|
||||||
options: {
|
options: {
|
||||||
@@ -157,21 +169,57 @@ module.exports = function (options) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
loader: 'sass-loader',
|
loader: 'sass-loader',
|
||||||
|
options: {
|
||||||
|
sourceMap: true,
|
||||||
|
includePaths: [path.join(themePath, 'styles')]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
loader: 'sass-resources-loader',
|
||||||
|
options: {
|
||||||
|
resources: globalCSSImports(env)
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
loader: 'string-replace-loader',
|
||||||
|
options: themeReplaceOptions
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
test: /(_exposed)?_variables.scss$/,
|
||||||
|
exclude: [/node_modules/],
|
||||||
|
use: [
|
||||||
|
{
|
||||||
|
loader: 'css-loader',
|
||||||
|
options: {
|
||||||
|
sourceMap: true,
|
||||||
|
modules: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
loader: 'postcss-loader',
|
||||||
options: {
|
options: {
|
||||||
sourceMap: true
|
sourceMap: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
loader: 'resolve-url-loader',
|
||||||
|
options: {
|
||||||
|
sourceMap: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
loader: 'sass-loader',
|
||||||
|
options: {
|
||||||
|
sourceMap: true,
|
||||||
|
includePaths: [path.join(themePath, 'styles')]
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
loader: 'string-replace-loader',
|
loader: 'string-replace-loader',
|
||||||
options: themeReplaceOptions
|
options: themeReplaceOptions
|
||||||
},
|
}
|
||||||
{
|
|
||||||
loader: 'sass-resources-loader',
|
|
||||||
options: {
|
|
||||||
resources: globalCSSImports
|
|
||||||
},
|
|
||||||
},
|
|
||||||
'webpack-import-glob-loader'
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user