Update file-loader

This commit is contained in:
Jaco Greeff 2017-08-03 13:30:17 +02:00
parent e99f86a052
commit 34f9e69bff
3 changed files with 20 additions and 54 deletions

View File

@ -122,7 +122,7 @@ export default class Dapp extends Component {
? app.id ? app.id
: this.context.api.sha3(app.url); : this.context.api.sha3(app.url);
src = `${dapphost}/dapps/${appId}/index.html`; src = `${dapphost}/dapps/${appId}/`;
break; break;
} }

View File

@ -15,7 +15,6 @@
// along with Parity. If not, see <http://www.gnu.org/licenses/>. // along with Parity. If not, see <http://www.gnu.org/licenses/>.
import 'whatwg-fetch'; import 'whatwg-fetch';
// import 'semantic-ui-css/semantic.css';
import es6Promise from 'es6-promise'; import es6Promise from 'es6-promise';
es6Promise.polyfill(); es6Promise.polyfill();

View File

@ -46,7 +46,7 @@ const isEmbed = EMBED === '1' || EMBED === 'true';
const entry = isEmbed const entry = isEmbed
? { embed: './embed.js' } ? { embed: './embed.js' }
: { index: './index.js' }; : { bundle: './index.js' };
module.exports = { module.exports = {
cache: !isProd, cache: !isProd,
@ -66,7 +66,7 @@ module.exports = {
{ {
test: /\.js$/, test: /\.js$/,
exclude: /(node_modules)/, exclude: /(node_modules)/,
use: [ 'happypack/loader?id=babel' ] use: ['happypack/loader?id=babel']
}, },
{ {
test: /\.json$/, test: /\.json$/,
@ -74,26 +74,7 @@ module.exports = {
}, },
{ {
test: /\.ejs$/, test: /\.ejs$/,
use: [ 'ejs-loader' ] use: ['ejs-loader']
},
{
test: /\.html$/,
use: [
{
loader: 'file-loader',
options: {
name: '[name].[ext]'
}
},
'extract-loader',
{
loader: 'html-loader',
options: {
root: path.resolve(__dirname, '../assets/images'),
attrs: ['img:src', 'link:href']
}
}
]
}, },
{ {
test: /\.md$/, test: /\.md$/,
@ -102,7 +83,15 @@ module.exports = {
{ {
test: /\.css$/, test: /\.css$/,
include: /semantic-ui-css/, include: /semantic-ui-css/,
use: [ 'style-loader', 'css-loader' ] use: [
'style-loader',
{
loader: 'css-loader',
options: {
minimize: true
}
}
]
}, },
{ {
test: /\.css$/, test: /\.css$/,
@ -132,36 +121,14 @@ module.exports = {
] ]
}, },
{ {
test: /\.(png|jpg)$/, test: /\.(png|jpg|svg|woff|woff2|ttf|eot|otf)(\?.*)?$/,
use: [ { use: {
loader: 'file-loader', loader: 'file-loader',
options: { options: {
name: 'assets/[name].[hash].[ext]' name: '[name].[hash:base64:10].[ext]',
useRelativePath: true
} }
} ]
},
{
test: /\.(woff|woff2|ttf|eot|otf)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
use: [ {
loader: 'file-loader',
options: {
name: 'fonts/[name][hash].[ext]'
} }
} ]
},
{
test: /parity-logo-white-no-text\.svg/,
use: [ 'url-loader' ]
},
{
test: /\.svg(\?v=[0-9]\.[0-9]\.[0-9])?$/,
exclude: [ /parity-logo-white-no-text\.svg/ ],
use: [ {
loader: 'file-loader',
options: {
name: 'assets/[name].[hash].[ext]'
}
} ]
} }
], ],
noParse: [ noParse: [
@ -198,7 +165,7 @@ module.exports = {
filename: 'index.html', filename: 'index.html',
template: './index.ejs', template: './index.ejs',
favicon: FAVICON, favicon: FAVICON,
chunks: [ 'index' ] chunks: ['bundle']
}), }),
new CopyWebpackPlugin( new CopyWebpackPlugin(
@ -246,7 +213,7 @@ module.exports = {
filename: 'embed.html', filename: 'embed.html',
template: './index.ejs', template: './index.ejs',
favicon: FAVICON, favicon: FAVICON,
chunks: [ 'embed' ] chunks: ['embed']
}) })
); );
} }