nexshop-web-skeleton
Version:
Nexshop Web Skeleton Project
105 lines (103 loc) • 3.96 kB
JavaScript
const path = require('path');
const appPath = process.cwd();
const HtmlWebpackPlugin = require('html-webpack-plugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const webpack = require('webpack');
const sourceSet = [
path.resolve(appPath, 'src'),
path.resolve(appPath, 'spec'),
path.resolve(appPath, 'static'),
path.resolve(appPath, 'index.html'),
path.resolve(appPath, 'node_modules/nexshop-web-contents'),
path.resolve('../../packages/nexshop-web-contents'),
path.resolve(appPath, 'node_modules/nexshop-web-navigation'),
path.resolve('../../packages/nexshop-web-navigation'),
path.resolve(appPath, 'node_modules/nexshop-web-schedule'),
path.resolve('../../packages/nexshop-web-schedule'),
path.resolve(appPath, 'node_modules/nexshop-web-dialog'),
path.resolve('../../packages/nexshop-web-dialog'),
path.resolve(appPath, 'node_modules/nexshop-web-screen'),
path.resolve('../../packages/nexshop-web-screen'),
path.resolve(appPath, 'node_modules/nexshop-web-contents-mini-view'),
path.resolve('../../packages/nexshop-web-contents-mini-view'),
path.resolve(appPath, 'node_modules/nexshop-web-store'),
path.resolve('../../packages/nexshop-web-store'),
path.resolve(appPath, 'node_modules/nexshop-web-popup'),
path.resolve('../../packages/nexshop-web-popup'),
path.resolve(appPath, 'node_modules/nexshop-web-search'),
path.resolve('../../packages/nexshop-web-search'),
path.resolve(appPath, 'node_modules/nexshop-web-admin'),
path.resolve('../../packages/nexshop-web-admin'),
path.resolve(appPath, 'node_modules/nexshop-web-tree-group'),
path.resolve('../../packages/nexshop-web-tree-group'),
path.resolve(appPath, 'node_modules/nexshop-web-elements'),
path.resolve('../../packages/nexshop-web-elements'),
];
module.exports = {
entry: {
nexshopApp: ['babel-polyfill', path.join(appPath, 'src/index')],
},
output: {
path: path.join(appPath, "dist"),
filename: "[name].bundle.[hash].js",
publicPath: "/"
},
devtool: '#source-map',
module: {
rules: [
{
test: /(\.js)|(\.jsx)$/,
include: sourceSet,
use: ["babel-loader"],
exclude: /node_modules\/(?!(nexshop-web-).*).*/,
},
{
test: /(\.scss)|(\.css)/,
include: sourceSet,
use: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: ['css-loader', 'sass-loader'],
}),
exclude: /node_modules\/(?!(nexshop-web-).*).*/,
},
{
test: /(\.png)|(\.svg)/,
include: sourceSet,
use: ['url-loader'],
exclude: /node_modules\/(?!(nexshop-web-).*).*/,
}
]
},
resolve: {
alias: {
'react': path.resolve('./node_modules/react'),
'react-dom': path.resolve('./node_modules/react-dom'),
'react-router-dom': path.resolve('./node_modules/react-router-dom'),
},
},
devServer: {
contentBase: path.join(appPath, "dist"),
port: 8000,
inline: true,
watchContentBase: true,
historyApiFallback: true,
disableHostCheck: true,
host: '0.0.0.0',
open: true,
proxy: {
'/api/v1': {
target: 'http://nexshop-api-gateway-manualtest.ap-northeast-2.elasticbeanstalk.com/',
secure: false
}
}
},
plugins: [
new HtmlWebpackPlugin({
title: 'Nexshop Marketing',
template: 'index.html',
favicon: path.join(appPath, 'static/iron_man.png'),
}),
new ExtractTextPlugin("[name].styles.[hash].css"),
new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
],
};