-
-
Notifications
You must be signed in to change notification settings - Fork 389
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: support ES module syntax (#472)
- Loading branch information
1 parent
c7eda97
commit 2f72e1a
Showing
29 changed files
with
1,115 additions
and
770 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
body { | ||
background: red; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
import './style.css'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
body { | ||
background: red; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import Self from '../../../src'; | ||
|
||
module.exports = { | ||
entry: './index.js', | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.css$/, | ||
use: [ | ||
Self.loader, | ||
{ | ||
loader: 'css-loader', | ||
// TODO Uncomment after `css-loader` release the `esModule` option | ||
// options: { esModule: false }, | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
plugins: [ | ||
new Self({ | ||
filename: '[name].css', | ||
}), | ||
], | ||
}; |
12 changes: 12 additions & 0 deletions
12
test/cases/simple-css-modules-mode-global/expected/main.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
.a { | ||
background: red; | ||
} | ||
|
||
.foo__style__b { | ||
color: green; | ||
} | ||
|
||
.c { | ||
color: blue; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
import './style.css'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
.a { | ||
background: red; | ||
} | ||
|
||
:local(.b) { | ||
color: green; | ||
} | ||
|
||
:global(.c) { | ||
color: blue; | ||
} |
29 changes: 29 additions & 0 deletions
29
test/cases/simple-css-modules-mode-global/webpack.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import Self from '../../../src'; | ||
|
||
module.exports = { | ||
entry: './index.js', | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.css$/, | ||
use: [ | ||
Self.loader, | ||
{ | ||
loader: 'css-loader', | ||
options: { | ||
modules: { | ||
mode: 'global', | ||
localIdentName: 'foo__[name]__[local]', | ||
}, | ||
}, | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
plugins: [ | ||
new Self({ | ||
filename: '[name].css', | ||
}), | ||
], | ||
}; |
12 changes: 12 additions & 0 deletions
12
test/cases/simple-css-modules-mode-local/expected/main.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
.foo__style__a { | ||
background: red; | ||
} | ||
|
||
.foo__style__b { | ||
color: green; | ||
} | ||
|
||
.c { | ||
color: blue; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
import './style.css'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
.a { | ||
background: red; | ||
} | ||
|
||
:local(.b) { | ||
color: green; | ||
} | ||
|
||
:global(.c) { | ||
color: blue; | ||
} |
29 changes: 29 additions & 0 deletions
29
test/cases/simple-css-modules-mode-local/webpack.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import Self from '../../../src'; | ||
|
||
module.exports = { | ||
entry: './index.js', | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.css$/, | ||
use: [ | ||
Self.loader, | ||
{ | ||
loader: 'css-loader', | ||
options: { | ||
modules: { | ||
mode: 'local', | ||
localIdentName: 'foo__[name]__[local]', | ||
}, | ||
}, | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
plugins: [ | ||
new Self({ | ||
filename: '[name].css', | ||
}), | ||
], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
.foo__style__a { | ||
background: red; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
import './style.css'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.a { | ||
background: red; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import Self from '../../../src'; | ||
|
||
module.exports = { | ||
entry: './index.js', | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.css$/, | ||
use: [ | ||
Self.loader, | ||
{ | ||
loader: 'css-loader', | ||
options: { | ||
modules: { | ||
mode: 'pure', | ||
localIdentName: 'foo__[name]__[local]', | ||
}, | ||
}, | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
plugins: [ | ||
new Self({ | ||
filename: '[name].css', | ||
}), | ||
], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
body { | ||
background: red; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
import './style.css'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
body { | ||
background: red; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import Self from '../../../src'; | ||
|
||
module.exports = { | ||
entry: './index.js', | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.css$/, | ||
use: [ | ||
Self.loader, | ||
{ | ||
loader: 'css-loader', | ||
// TODO Uncomment after `css-loader` release the `esModule` option | ||
// options: { esModule: true }, | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
plugins: [ | ||
new Self({ | ||
filename: '[name].css', | ||
}), | ||
], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.