Skip to content

Commit

Permalink
chore: add css to the dynamic import example
Browse files Browse the repository at this point in the history
supports #40
  • Loading branch information
DanielSchaffer committed Nov 1, 2019
1 parent 86443ce commit 9d8d080
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 1 deletion.
1 change: 1 addition & 0 deletions examples/es6-dynamic-import/src/entry.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { GTG } from '../../_shared/constants'
import { createDom } from '../../_shared/es6-dom'
import { es6 } from '../../_shared/logos'
import ready from '../../_shared/ready'
import './styles.css'

// needed to trigger Babel including array.es6.iterator polyfill
// see https://github.com/DanielSchaffer/babel-ie11-dynamic-import-array-iterator-repro
Expand Down
2 changes: 2 additions & 0 deletions examples/es6-dynamic-import/src/plugins/a/plugin.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
import './styles-a.css'

const log = () => console.log('plugin a')
log()
3 changes: 3 additions & 0 deletions examples/es6-dynamic-import/src/plugins/a/styles-a.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
html {
background: red;
}
2 changes: 2 additions & 0 deletions examples/es6-dynamic-import/src/plugins/b/plugin.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
import './styles-b.css'

const log = () => console.log('plugin b')
log()
3 changes: 3 additions & 0 deletions examples/es6-dynamic-import/src/plugins/b/styles-b.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
html {
background: blue;
}
3 changes: 3 additions & 0 deletions examples/es6-dynamic-import/src/styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
html {
background: white;
}
12 changes: 11 additions & 1 deletion examples/es6-dynamic-import/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
const BabelMultiTargetPlugin = require('../../').BabelMultiTargetPlugin
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
// const NamedLazyChunksPlugin = require('../../').NamedLazyChunksPlugin

const BabelMultiTargetPlugin = require('../../').BabelMultiTargetPlugin

/**
* @type {Configuration}
*
Expand All @@ -18,12 +20,20 @@ module.exports = {
test: /\.js$/,
use: BabelMultiTargetPlugin.loader(),
},
{
test: /\.css$/,
use: [
MiniCssExtractPlugin.loader,
'css-loader',
],
},
],
},

plugins: [
// enable for smarter dynamic chunk naming
// new NamedLazyChunksPlugin(),
new MiniCssExtractPlugin(),
],

}

0 comments on commit 9d8d080

Please sign in to comment.