Commit 278fd54e authored by Guy Bedford's avatar Guy Bedford Committed by Joe Haddad

@ampproject/toolbox-optimizer

parent 35a6710c
......@@ -4,7 +4,7 @@ export default async function optimize(
): Promise<string> {
let AmpOptimizer
try {
AmpOptimizer = require('@ampproject/toolbox-optimizer')
AmpOptimizer = require('next/dist/compiled/ampproject--toolbox-optimizer')
} catch (_) {
return html
}
......
......@@ -57,7 +57,6 @@
]
},
"dependencies": {
"@ampproject/toolbox-optimizer": "2.0.1",
"@babel/core": "7.7.2",
"@babel/plugin-proposal-class-properties": "7.7.0",
"@babel/plugin-proposal-nullish-coalescing-operator": "7.7.4",
......@@ -116,6 +115,7 @@
"react-dom": "^16.6.0"
},
"devDependencies": {
"@ampproject/toolbox-optimizer": "2.0.1",
"@next/polyfill-nomodule": "9.3.4-canary.0",
"@taskr/clear": "1.1.0",
"@taskr/esnext": "1.1.0",
......
......@@ -48,6 +48,16 @@ export async function ncc_amphtml_validator(task, opts) {
.target('dist/compiled/amphtml-validator')
}
// eslint-disable-next-line camelcase
export async function ncc_ampproject__toolbox_optimizer(task, opts) {
await task
.source(
opts.src ||
relative(__dirname, require.resolve('@ampproject/toolbox-optimizer'))
)
.ncc({ packageName: '@ampproject/toolbox-optimizer', externals })
.target('dist/compiled/ampproject--toolbox-optimizer')
}
// eslint-disable-next-line camelcase
export async function ncc_arg(task, opts) {
await task
.source(opts.src || relative(__dirname, require.resolve('arg')))
......@@ -343,6 +353,7 @@ export async function precompile(task) {
await task.parallel([
'browser_polyfills',
'ncc_amphtml_validator',
'ncc_ampproject__toolbox_optimizer',
'ncc_arg',
'ncc_async_retry',
'ncc_async_sema',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment