就像加载 JavaScript 那样,加载 CoffeeScript
npm install --save-dev coffee-loader
import coffee from 'coffee-loader!./file.coffee';
##
import coffee from 'file.coffee';
webpack.config.js
module.exports = {
module: {
rules: [
{
test: /\.coffee$/,
use: [ 'coffee-loader' ]
}
]
}
}
literate
false
file.coffee.md
transpile
false
Literate
Literate
" class="icon-link" href="#literate">
webpack.config.js
module.exports = {
module: {
rules: [
{
test: /\.coffee.md$/,
use: [
{
loader: 'coffee-loader',
options: { literate: true }
}
]
}
]
}
}
Sourcemaps
source maps 总是产生。
Transpile
Transpile
" class="icon-link" href="#transpile">
webpack.config.js
module.exports = {
module: {
rules: [
{
test: /\.coffee$/,
use: [
{
loader: 'coffee-loader',
options: {
transpile: {
presets: ['env']
}
}
}
]
}
]
}
}
Juho Vepsäläinen |
Joshua Wiens |
Kees Kluskens |
Sean Larkin |