mirror of
https://github.com/terribleplan/next.js.git
synced 2024-01-19 02:48:18 +00:00
webpack: emit json and apply json-loader after emitting files (#298)
This commit is contained in:
parent
f9726a5d59
commit
fc369fa240
|
@ -74,18 +74,7 @@ export default async function createCompiler (dir, { hotReload = false, dev = fa
|
|||
const babelRuntimePath = require.resolve('babel-runtime/package')
|
||||
.replace(/[\\/]package\.json$/, '')
|
||||
|
||||
const loaders = [{
|
||||
test: /\.js$/,
|
||||
loader: 'emit-file-loader',
|
||||
include: [dir, nextPagesDir],
|
||||
exclude (str) {
|
||||
return /node_modules/.test(str) && str.indexOf(nextPagesDir) !== 0
|
||||
},
|
||||
query: {
|
||||
name: 'dist/[path][name].[ext]'
|
||||
}
|
||||
}]
|
||||
.concat(hotReload ? [{
|
||||
const loaders = (hotReload ? [{
|
||||
test: /\.js$/,
|
||||
loader: 'hot-self-accept-loader',
|
||||
include: [
|
||||
|
@ -94,6 +83,19 @@ export default async function createCompiler (dir, { hotReload = false, dev = fa
|
|||
]
|
||||
}] : [])
|
||||
.concat([{
|
||||
test: /\.json$/,
|
||||
loader: 'json-loader'
|
||||
}, {
|
||||
test: /\.(js|json)$/,
|
||||
loader: 'emit-file-loader',
|
||||
include: [dir, nextPagesDir],
|
||||
exclude (str) {
|
||||
return /node_modules/.test(str) && str.indexOf(nextPagesDir) !== 0
|
||||
},
|
||||
query: {
|
||||
name: 'dist/[path][name].[ext]'
|
||||
}
|
||||
}, {
|
||||
loader: 'babel',
|
||||
include: nextPagesDir,
|
||||
query: {
|
||||
|
@ -180,9 +182,6 @@ export default async function createCompiler (dir, { hotReload = false, dev = fa
|
|||
},
|
||||
plugins,
|
||||
module: {
|
||||
preLoaders: [
|
||||
{ test: /\.json$/, loader: 'json-loader' }
|
||||
],
|
||||
loaders
|
||||
},
|
||||
customInterpolateName: function (url, name, opts) {
|
||||
|
|
Loading…
Reference in a new issue