Issue 1:
Problem

My team is maintaining a large front end application with the same file hierarchy as:-

component

pages

but we don't like it. We usually have multiple component that is only used by a single page resulting whenever we found bugs or wanted to modify a page, we have to navigate though component to find the components related to the page. Its a pain in developing. So, we prefer the approach of:-

pages

page

index.js

component

and we are looking for a new framework to use

Ideal case

We would name our pages and components differently

pages

page

index.page.js

component

component.component.js

We would use pagesGlobPattern to only render files ending with .page.js ignoring .component.js

But then we would need another option to ask next to treat index.page.js as index.js

I have searched the issues of this repository and believe that this is not a duplicate.

Issue 2:
Hey Zeit / team! First of all, thanks for all of the hard work on NextJS / Now it's a match made and heaven and I'm insanely excited to be able to migrate a large production app over to the platform.

I have searched the issues of this repository and believe that this is not a duplicate.

Expected Behavior

Builds should always be deployable via now and should pass remotely as long as they're passing locally. (considering we're not using any global modules, etc) .. I'm not sure if this is an issue with Next or with Now, but building my app locally works 100% of the time via NODE_ENV=production next build .. which is the step that I believe is failing remotely.

Current Behavior

Sometimes when deploying our app, it will fail intermittently. Upon retrying, it will sometimes work, and other times not .. I'm not sure whether or not it's timing out, or what is actually causing these failures. I just get the obscure "Build Error"

Your Environment

Tech
Version

next
latest

node
9.0.0

OS
OS X High Seirra

browser
N/A

This could be related to #1195 .. as I've had to add my own uglifyjs set up to my next.config.js

My next.config.js looks like this:

const variables = require('./components/style-helpers/global-variables.js')
const UglifyJSPlugin = require('uglifyjs-webpack-plugin')

module.exports = {
webpack: function (config, { dev }) {
console.log(`Environment: ${process.env.NODE_ENV}`)

if (!dev) {
console.log('Uglifying JS')
// remove this once this is resolved: https://github.com/zeit/next.js/issues/1195
config.plugins = config.plugins.filter(p => p.constructor.name !== 'UglifyJsPlugin')
config.plugins.push(
new UglifyJSPlugin({
parallel: true
})
)
} else {
// https://webpack.js.org/configuration/devtool/
config.devtool = 'source-map'
}

config.module.rules.push(
{
test: /\.(jpg|svg|png|woff)$/,
loader: 'url-loader?limit=25000'
},
{
test: /\.css$/,
use: [
{
loader: 'emit-file-loader',
options: {
name: 'dist/[path][name].[ext]'
}
},
'babel-loader',
'styled-modules/loader',
'css-loader?modules',
{
loader: 'postcss-loader',
options: {
ident: 'postcss',
plugins: (loader) => [
require('postcss-custom-properties')({ variables, warnings: false, strict: false }),
require('postcss-easy-import')({prefix: '_'}),
require('postcss-cssnext')(),
require('postcss-nested')()
]
}
}
]
}
)

return config
}
}

And this has been the intermitten experience I've been having:

I can provide any additional information if I left anything out, but this has been kicking my butt so I'd really love if I could get some other eyes on this!