|
|
|
@ -8,9 +8,13 @@ dotenv.config({ path: '../sapl/.env' }) |
|
|
|
var THEME_CUSTOM = process.env.THEME_CUSTOM === undefined ? 'sapl-oficial-theme' : process.env.THEME_CUSTOM |
|
|
|
|
|
|
|
module.exports = { |
|
|
|
publicPath: 'http://localhost:8080/', |
|
|
|
publicPath: process.env.NODE_ENV === 'production' ? '/static/' : 'http://localhost:8080/', |
|
|
|
outputDir: './dist/', |
|
|
|
|
|
|
|
configureWebpack: { |
|
|
|
devtool: 'cheap-module-eval-source-map', |
|
|
|
}, |
|
|
|
|
|
|
|
chainWebpack: config => { |
|
|
|
config.optimization |
|
|
|
.splitChunks(false) |
|
|
|
@ -19,8 +23,6 @@ module.exports = { |
|
|
|
.plugin('BundleTracker') |
|
|
|
.use(BundleTracker, [{ filename: './webpack-stats.json' }]) |
|
|
|
|
|
|
|
config.devtool = 'source-map' |
|
|
|
|
|
|
|
config.resolve.alias |
|
|
|
.set('__STATIC__', 'static') |
|
|
|
|
|
|
|
@ -36,11 +38,50 @@ module.exports = { |
|
|
|
.contentBase([ |
|
|
|
path.join(__dirname, 'public'), |
|
|
|
path.join(__dirname, 'src', 'assets'), |
|
|
|
path.join(__dirname, 'node_modules', THEME_CUSTOM, 'public') |
|
|
|
//path.join(__dirname, 'node_modules', THEME_CUSTOM, 'public'),
|
|
|
|
//path.join(__dirname, 'node_modules', THEME_CUSTOM, 'src', 'assets')
|
|
|
|
]) |
|
|
|
|
|
|
|
config.entryPoints.delete('app') |
|
|
|
config |
|
|
|
.plugin('copy') |
|
|
|
.tap(([options]) => { |
|
|
|
options.push( |
|
|
|
{ |
|
|
|
from: path.join(__dirname, 'node_modules', THEME_CUSTOM, 'public'), |
|
|
|
to: path.join(__dirname, 'dist'), |
|
|
|
toType: 'dir', |
|
|
|
ignore: [ |
|
|
|
'.DS_Store' |
|
|
|
] |
|
|
|
}) |
|
|
|
return [options] |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
/* |
|
|
|
new CopyWebpackPlugin( |
|
|
|
[ |
|
|
|
{ |
|
|
|
from: '/home/leandro/desenvolvimento/envs/sapl/sapl-frontend/public', |
|
|
|
to: '/home/leandro/desenvolvimento/envs/sapl/sapl-frontend/dist', |
|
|
|
toType: 'dir', |
|
|
|
ignore: [ |
|
|
|
'.DS_Store' |
|
|
|
] |
|
|
|
} |
|
|
|
] |
|
|
|
), |
|
|
|
config |
|
|
|
.module |
|
|
|
.rule('images') |
|
|
|
.use('url-loader') |
|
|
|
.loader('url-loader') |
|
|
|
.tap(options => { |
|
|
|
options.fallback.options.name = (process.env.NODE_ENV === 'production' |
|
|
|
? '/static/' |
|
|
|
: '') + options.fallback.options.name |
|
|
|
return options |
|
|
|
}) */ |
|
|
|
config |
|
|
|
.plugin('provide') |
|
|
|
.use(require('webpack/lib/ProvidePlugin'), [{ |
|
|
|
@ -50,13 +91,16 @@ module.exports = { |
|
|
|
jQuery: 'jquery', |
|
|
|
_: 'lodash' |
|
|
|
}]) |
|
|
|
config.entryPoints.delete('app') |
|
|
|
|
|
|
|
config.entry(THEME_CUSTOM) |
|
|
|
config |
|
|
|
.entry(THEME_CUSTOM) |
|
|
|
.add('./src/theme-dev/main.js') |
|
|
|
// .add(THEME_CUSTOM + '/src/main.js')
|
|
|
|
.end() |
|
|
|
|
|
|
|
config.entry('global') |
|
|
|
config |
|
|
|
.entry('global') |
|
|
|
.add('./src/global/main.js') |
|
|
|
.end() |
|
|
|
|
|
|
|
|